Boost logo

Boost Users :

Subject: Re: [Boost-users] [multi-index] multi-index type trait
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2015-08-18 04:49:54


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<typ…µ”¸¸¸ɝÌø(€€€ÍÑÉՍЁ¥Í}­•å}‰…Í•‘}¥¹‘•àð(€€€€€‰½½ÍÐèéµÕ±Ñ¥}¥¹‘•àèé¡…Í¡•‘}Õ¹¥ÅÕ”ñɝ̸¸¸ø(€€€€ø鉽½ÍÐèéµÁ°èéÑÉÕ•}íôì(€€€€(€€€Ñ•µÁ±…Ñ”ñÑåÁ•¹…µ”¸¸¸ɝÌø(€€€ÍÑÉՍЁ¥Í}­•å}‰…Í•‘}¥¹‘•àð(€€€€€‰½½ÍÐèéµÕ±Ñ¥}¥¹‘•àèé¡…Í¡•‘}¹½¹}Õ¹¥ÅÕ”ñɝ̸¸¸ø(€€€€ø鉽½ÍÐèéµÁ°èéÑÉÕ•}íôì(€€€€(€€€Ñ•µÁ±…Ñ”ñÑåÁ•¹…µ”5ձѥ%¹‘•á ½¹Ñ…¥¹•Èø(€€€ÍÑÉՍЁ¥Í}™¥ÉÍÑ}¥¹‘•á}­•å}‰…Í•è(€€€€€¥Í}­•å}‰…Í•‘}¥¹‘•àð(€€€€€€€ÑåÁ•¹…µ”‰½½ÍÐèéµÁ°èé™É½¹Ðð(€€€€€€€€€ÑåÁ•¹…µ”5ձѥ%¹‘•á ½¹Ñ…¥¹•Èè饹‘•á}ÍÁ•¥™¥•É}ÑåÁ•}±¥ÍÐ(€€€€€€€€øèéÑåÁ”(€€€€€€ø(€€€íôì()Õ±°•á…µÁ±”…Ё¡ÑÑÀè¼½½±¥ÉÔ¹ÍÑ…­•µÉ½½­•¹½´½„¼äÌÙ…‘ÄÀÐÄØÈÀÈՐ())½…Å×µ¸43ÍÁ•è5׎è)Q•±•›͹¥


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net