Boost logo

Boost :

Subject: Re: [boost] [variant] awkward recursion
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-11-02 10:21:59


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk