
Elizabeta <elizabeta.petreska <at> gmail.com> 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 <boost/multi_index/ordered_index_fwd.hpp> #include <boost/multi_index/hashed_index_fwd.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/front.hpp> template<typename Index> struct is_key_based_index:boost::mpl::false_{}; template<typename... Args> struct is_key_based_index< boost::multi_index::ordered_unique<Args...> >:boost::mpl::true_{}; template<typename... Args> struct is_key_based_index< boost::multi_index::ordered_non_unique<Args...> >:boost::mpl::true_{}; template<typename... Args> struct is_key_based_index< boost::multi_index::hashed_unique<Args...> >:boost::mpl::true_{}; template<typename... Args> struct is_key_based_index< boost::multi_index::hashed_non_unique<Args...> >: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