Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-Index] has_index<BMI,TAG> meta-function
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2009-07-14 19:48:38


On Tue, Jul 14, 2009 at 5:49 PM, JOAQUIN M. LOPEZ MUÑOZ<joaquin_at_[hidden]> wrote:
>>     using namespace boost;
>>     using boost::multi_index::detail::has_tag;
>>
>>     template<typename BMI, typename TAG>
>>     struct has_index {
>>         typedef typename BMI::index_type_list index_type_list;
>>         typedef typename mpl::end<index_type_list>::type index_type_list_end;
>>         typedef typename has_tag<TAG>::template
>> apply<index_type_list>::type iter;
>
> has_tag applies to each index individually, not the entire index_type_list.

I see it now. Thanks for pointing it out.

One last question tonight :)

Similarly to how I can now statically enable/disable code based on
which index is implemented by a BMI, can one also change that code
based on whether the index is unique vs non-unique? Or ordered vs
hashed? For example, using D's static if, could I do

static if (index.is_unique) {
    // using index.find
} else {
    // using index.equal_range
}

Thanks, --DD


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