I have a scenario I've often wondered about.
Someone creates an std::vector<someType>, and an std::vector<otherType>. Both types are identical to an uint64 (example).
Would the compiler emit code for both types, or smartly deduplicate this and emit a set of functions being used just once? In my head this would seem possible, but may require RTTI to tell "this vector" from "that vector". I've wondered if this is the reason C++ can create such large binaries.
Is this dangerous? Is this common? Does it incur RTTI overhead or something? Is this called something specific in this list?
https://en.wikipedia.org/wiki/Category:Compiler_optimizations
Thank you.