| Front Page / Sequences / Intrinsic Metafunctions / value_type |
template<
typename Sequence
, typename X
>
struct value_type
{
typedef unspecified type;
};
Returns the value that would be used for element X in Sequence.
#include <boost/mpl/value_type.hpp>
| Parameter | Requirement | Description |
|---|---|---|
| Sequence | Associative Sequence | A sequence to query. |
| X | Any type | The type to get the value for. |
For any Associative Sequence s, and an artibrary type x:
typedef value_type<s,x>::type v;
| Return type: | A type. |
|---|---|
| Precondition: | x can be put in s. |
| Semantics: | v is the value that would be used for x in s. |
| Postcondition: | If .. parsed-literal: has_key< s,key_type<s,x>::type >::type then .. parsed-literal: at< s,key_type<s,x>::type >::type is identical to value_type<s,x>::type. |
Amortized constant time.
typedef value_type< map<>,pair<int,unsigned> >::type v1; typedef value_type< set<>,pair<int,unsigned> >::type v2; BOOST_MPL_ASSERT(( is_same< v1,unsigned > )); BOOST_MPL_ASSERT(( is_same< v2,pair<int,unsigned> > ));