Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-12-29 08:07:19


mpl has int_ which wraps an int value, but I've needed
something similar for other types, in particular,
for enumerated types. I'm suggesting something
like:

//template to create a type from a value of some type.
template
   < typename ValueType //type of value to be "typified"
>
   struct
value2type
{
         typedef
       ValueType
     value_type
     ;
     template
       < value_type ValueInstance //value to be typified.
>
       struct
     instance //the type created from ValueInstance
     {};
};

The name is modelled after In2Type in Alexandrescu's
_Modern C++ Design_ which is also where the "typified"
comes from.

Could this template, or something like it be added to mpl?


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