
2 Nov
2012
2 Nov
'12
2:21 p.m.
On 31/10/12 19:02, Dave Abrahams wrote:
namespace wrapper { struct value;
template <class T, class U> struct mymap : std::map<T,U> { enum { _size = sizeof(T)+sizeof(U) }; // error if T or U are incomplete }; typedef mymap<std::string, value> object;
This line instantiates the declaration of std::map<std::string, value>, but not its definition, which is why you don't get any error (doing those sizeofs inside the declaration itself will yield errors though of course). I'm no expert at standardese but it seems class template instantiation usually refers to instantiating the definition, which would mean that this is indeed allowed.