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:
#include
#include
#include
#include
template<typename Index>
struct is_key_based_index:boost::mpl::false_{};
template
struct is_key_based_index<
boost::multi_index::ordered_unique
>:boost::mpl::true_{};
template
struct is_key_based_index<
boost::multi_index::ordered_non_unique
>:boost::mpl::true_{};
template
struct is_key_based_index<
boost::multi_index::hashed_unique
>:boost::mpl::true_{};
template
struct is_key_based_index<
boost::multi_index::hashed_non_unique
>:boost::mpl::true_{};
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/936add104162025d
Joaquín M López Muñoz
Telefónica