The problem is in the operator[] function. The code idx = 0 sets idx to 0. So all of your calls to operator[] will return the first element, and therefore there is no out-of-bounds error unless the array is empty. You probably meant to write if ( idx >= 0...

Are they a simple class or a class template? They are actually static constexpr declarations nested in the std::ios_base class (as from the reference documentation): How are they implemented? Which one is there parent class(if any)? As mentioned there, it's compiler implementation specific. Usually these are simple values without...

You said: template<typename A> Foo<A, Beta>::Foo(){/* some specialized construction */} //<- this doesn't work. You can use that only if you specialize the entire class. You can't specialize just one member function of the class. The following should work: template<typename A> class Foo<A, Beta> { Foo(); }; template<typename A> Foo<A,...

The members of the template class are defined as such (in a cpp-file): You seem to be assuming that those definitions will be instantiated in the cpp file, but unless something in that cpp file uses them the members will not be instantiated, and so the corresponding symbols will...

You don't have to nest them in one another, but you could nest them within a third type: template<class T> struct C { typedef A<T> A; typedef B<T> B; }; Client just access via C: C<T>::A a; C<T>::B b; ...

This is tricky, and it is covered by a C++ FAQ entry. I can't explain exactly why your compiler gives the errors it does. But your code for all the operators is incorrect: as explained in the FAQ, the compiler thinks you are trying to friend a non-template function, however...

That class template is forward declared in "units_fwd.hpp". template<class Dim,class System, class Enable=void> class unit; there we see that the 3rd parameter is defaulted to void. I would be tempted to even do template<class Dim,class System, class=void> class unit; and also leave it nameless in the implementation, but there may...