![]() |
![]() ![]() ![]() ![]() |
![]() |
The MPL Reference Manual: atBoost , ,
|
||||||||||||||||||||||||||||||||||||||||||||||||
| Front Page / Sequences / Intrinsic Metafunctions / at |
template<
typename Sequence
, typename N
>
struct at
{
typedef unspecified type;
};
template<
typename AssocSeq
, typename Key
, typename Default = unspecified
>
struct at
{
typedef unspecified type;
};
#include <boost/mpl/at.hpp>
| Parameter | Requirement | Description |
|---|---|---|
| Последовательность | Последовательность | Последовательность, которую нужно исследовать. |
| AssocSeq | Ассоциативная последовательность | Последовательность, которую нужно исследовать. |
| N | Интегральная постоянная | Смещение от начала последовательности, определяющей элемент, подлежащий извлечению. |
| Ключ | Любой тип | Ключ для извлечения элемента. |
| Дефолт | Любой тип | Значение по умолчанию возвращается, если элемент не найден. |
For any Forward Sequence s, and Integral Constant n:
typedef at<s,n>::type t;
| Return type: | A type. |
|---|---|
| Precondition: | 0 <= n::value < size<s>::value. |
| Semantics: | Equivalent to typedef deref< advance< begin<s>::type,n >::type >::type t; |
For any Associative Sequence s, and arbitrary types key and x:
typedef at<s,key,x>::type t;
| Return type: | A type. |
|---|---|
| Semantics: | If has_key<s,key>::value == true, t is the value type associated with key; otherwise t is identical to x. |
typedef at<s,key>::type t;
| Return type: | A type. |
|---|---|
| Semantics: | Equivalent to typedef at<s,key,void_>::type t; |
| Sequence archetype | Complexity |
|---|---|
| Последовательность | Линейный. |
| Последовательность случайного доступа | Амортизированное постоянное время. |
| Ассоциативная последовательность | Амортизированное постоянное время. |
typedef range_c<long,10,50> range; BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::value), ==, 10 ); BOOST_MPL_ASSERT_RELATION( (at< range, int_<10> >::value), ==, 20 ); BOOST_MPL_ASSERT_RELATION( (at< range, int_<40> >::value), ==, 50 );
typedef set< int const,long*,double > s; BOOST_MPL_ASSERT(( is_same< at<s,char>::type, void_ > )); BOOST_MPL_ASSERT(( is_same< at<s,int>::type, int > ));
Статья The MPL Reference Manual: at раздела может быть полезна для разработчиков на c++ и boost.
:: Главная :: ::
реклама |