upvote
Sorry if this is a dumb question but wouldn't vector<float> and vector<int> generate different code on get/set? Since floats go in different registers/need different instructions to load/store them to memory? Or is it something like, actually all of the std::vector functions technically operate on T&, and manipulating the pointers can use the same code, and really it's the optimizer that has to think about float vs int registers or something
reply
Well, you can do two or three main things:

- Use an algorithm and implementation that needs a small amount of code for each instance (that is where the skip list is useful)

- Have a shared "out of line" (not inline) implementation for bulky parts of the implementation, where possible

- Support the compiler + linker feature to merge identical functions by making code identical between template instantiations of similar enough types

reply