Boost logo

Boost Users :

Subject: [Boost-users] How to search multi_index container using composite key with date ranges
From: Jeff (jeffro59_at_[hidden])
Date: 2013-02-08 16:19:36


Hi,
I am having syntax issues and wish to search a bmi container by the
composite index defined below. I have read about boost::lambdas and
understand how they work. I simply have gotten stuck in the syntax to
perform the get on the index and how to create the tuple(s) containing the
proper objects.
 
I want to search such that searchKey1="key1" and searchKey2="key2"
and ValidFrom is <= '2013-03-01' and ValidTo >= '2013-02-08'. Can anyone
help me please?
 
Many Thanks!!
Jeff R.
 
 
bmi=boost::multi_index
bg=boost::gregorian
 
typedef bmi::multi_index_container<TestRecord,
   bmi::indexed_by<
     bmi::ordered_non_unique<
       bmi::tag<idx_test >,
         bmi::composite_key<TestRecord,
                  bmi::member<TestRecord, std::string,
&TestRecord::searchKey1>,
                  bmi::member<TestRecord, std::string,
&TestRecord::searchKey2>,
                  bmi::member<TestRecord, bg::date, &TestRecord::ValidFrom>,
                  bmi::member<TestRecord, bg::date, &TestRecord::ValidTo>
>
>
>
> TestCache;
 
 



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