Joaquin M Lopez Munoz writes:
Elizabeta writes:
Hi
how to test if the first index of boost::multi-index is key based or
sequence based at compile time[...]
This can do:
Correction: this is terser and is prepared for Boost 1.59 (which
includes a new type of key-based indices, namely ranked indices):
#include
#include
#include
#include
template<typename Index>
struct is_key_based_index:boost::mpl::true_{};
template
struct is_key_based_index<
boost::multi_index::sequenced
>:boost::mpl::false_{};
template
struct is_key_based_index<
boost::multi_index::random_access
>:boost::mpl::false_{};
template<typename MultiIndexContainer>
struct is_first_index_key_based:
is_key_based_index<
typename boost::mpl::front<
typename MultiIndexContainer::index_specifier_type_list
>::type
>
{};
Full example at http://coliru.stacked-crooked.com/a/5a01356f0908fd9a
Joaquín M López Muñoz
Telefónica