Boost logo

Boost :

From: Michael Marcin (mmarcin_at_[hidden])
Date: 2007-04-12 15:11:21

Jody Hagins wrote:
> On Thu, 12 Apr 2007 11:46:03 -0500
> "Michael Marcin" <mmarcin_at_[hidden]> wrote:
>> template <typename T, std::size_t N>
>> struct tag_of<boost::array<T, N> > {};
> Now you have defined the template. All non specialized stucts tag_of
> will be defined as an empty class. By simply declaring it, the onus
> is
> now on another piece of code to properly define the template. Someone
> can still provide a "general" definition, but it's very possible that
> specializations are the true desire.
> If you want an empty stuct to be the default template, then you can
> use
> the above. If, however, you want to force the template definitions
> then simply provide the forward declaration.
> With the forward declaration, if a user tries to use the struct in a
> non-specialized way, a compiler error will result, which is good. You
> don't want the user to get default "nothing" behavior from a typo.
> Does that make any sense at all?


IIUC what that forward declared partial specialization is doing is akin to
- I know the default implementation of tag_of can't be correct for
- There should be an implementation of tag_of that will make it work for
- I don't know what that implementation is, you or someone else better
provide it

Is it then true that when proper definition of the partial specialization is
provided this partial specialization of the declaration has no effect

If that is true and this is a compiler bug then perpahs we can use a
simply omit these these forward declarations on compilers that choke on them
(like CW 9.4 apparerently does).


Michael Marcin

Boost list run by bdawes at, gregod at, cpdaniel at, john at