* If you use std::vector<int>, std::vector<double> and std::vector<string> you will (probably) end up with three instantiations of std::vector ("probably" because the implementation has some leeway). This it no different than what you would get if you implemented std::vector with macros or by hand, but for some reason people like to count it as code bloat.
* Modern compilers have a tendency to instantiate the same template multiple times, (e.g., std::vector<int>, std::string) and then get rid of any duplicates ( https://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.ht... ). This affects compile times, but if the compiler/linker does a good job of getting rid of the duplicates it shouldn't affect executable size. Sadly, many compilers do a bad job of getting rid of duplicates. extern templates are supposed to help out now ( http://www.stroustrup.com/C++11FAQ.html#extern-templates ).
This it no different than what you would get if you implemented std::vector with macros or by hand, but for some reason people like to count it as code bloat.
Not if you implement it as a resizeable array of bytes, which is what a lot of the std::vector-ish structures I see being used in C are. There's just one set of functions which work with different element sizes, not a set of nearly-identical ones for each element size (and sometimes even multiple identical ones for elements of the same size but different type.) It's definitely bloat when the result is highly redundant and bigger than necessary.
Just as it is possible to implement a std::vector-like container using void* without templates, it is possible to do it with templates and partial specialization. It's a question of how much work the implementor put into things.
Isn't code bloat "defined" as code that is unnecessary? If it's used, it's not unnecessary. In C# with generics, the JIT compiler will generate seperate code paths for List<int>, List<double>, List<string>, etc. in order to speed up execution. The only difference with C++ templates is that it affects the executable size and is done before hand instead of at runtime (or ngen time).
* If you use std::vector<int>, std::vector<double> and std::vector<string> you will (probably) end up with three instantiations of std::vector ("probably" because the implementation has some leeway). This it no different than what you would get if you implemented std::vector with macros or by hand, but for some reason people like to count it as code bloat.
* Modern compilers have a tendency to instantiate the same template multiple times, (e.g., std::vector<int>, std::string) and then get rid of any duplicates ( https://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.ht... ). This affects compile times, but if the compiler/linker does a good job of getting rid of the duplicates it shouldn't affect executable size. Sadly, many compilers do a bad job of getting rid of duplicates. extern templates are supposed to help out now ( http://www.stroustrup.com/C++11FAQ.html#extern-templates ).