If I make some code like this:
boost::array<10> a1;
boost::array<20> a2;
boost::array<30> a3;
Will the template generate 3 different classes for me and make the size of my code grow?
If it does, is the compiler/linker smart enough to only include the methods definitions of what I’m actually using? For example: if I use the method ‘at’ of the a1 object, but never user the method ‘at’ of the a2 object, then the ‘at’ of the a2 would be totally discarded.
Yes; every instantiation of a template with different template arguments in in effect a different type.
Extremely unlikely, certainly no worse than enabling inlining does.
Yes, unless you explicitly instantiate the type as a whole.
If you never use the method
atofa2, and you didn’t explicitly instantiateboost::array<T, 20>as a whole, thenboost::array<T, 20>::at()is never instantiated to begin with and there’s nothing to discard.