Boost logo

Boost Users :

From: Markus Werle (numerical.simulation_at_[hidden])
Date: 2007-01-22 06:07:29


Hi!

I'd like to use boost::tuple in a list-replacing multiindex and use
the first entry in the tuple as key.
The following fails to compile.
Could you please provide a correction?

#include <boost/tuple/tuple.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/key_extractors.hpp>

namespace bm = ::boost::multi_index;

class C
{
    typedef boost::tuple<std::string, std::string> data_t;

    template <typename T>
    struct mutable_value
    {
        mutable_value(const T& t):t(t){}
        operator T&()const{return t;}
        
    private:
        mutable T t;
    };

    typedef bm::multi_index_container
    <mutable_value<data_t>,
     bm::indexed_by
     <bm::sequenced<>,
      bm::ordered_unique
      <bm::mem_fun<data_t,
                   std::string,
                   &data_t::get<0> > > > > storage_t;

    storage_t storage_;
};

int main()
{
    C c;
}


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