
Joaquin M Lopez Munoz <joaquin <at> tid.es> writes:
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:
Correction: this is terser and is prepared for Boost 1.59 (which includes a new type of key-based indices, namely ranked indices): #include <boost/multi_index/sequenced_index_fwd.hpp> #include <boost/multi_index/random_access_index_fwd.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/front.hpp> template<typename Index> struct is_key_based_index:boost::mpl::true_{}; template<typename... Args> struct is_key_based_index< boost::multi_index::sequenced<Args...> >:boost::mpl::false_{}; template<typename... Args> struct is_key_based_index< boost::multi_index::random_access<Args...> >: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