Boost logo

Boost Users :

Subject: [Boost-users] [MultiIndex] How to extract a key-extractor?
From: Igor R (boost.lists_at_[hidden])
Date: 2013-07-25 07:24:31


Hello,

The following code is expected to get the key-extractor, but it
doesn't compile. How to do this correctly?

Thanks.

#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/mem_fun.hpp>

struct A
{
  int f() const
  {
    return 0;
  }
};

typedef boost::multi_index::multi_index_container<
        int,
  boost::multi_index::indexed_by<
    boost::multi_index::ordered_unique<
      boost::multi_index::const_mem_fun<A, int, &A::f>
>
>
> container_type;

typedef container_type::key_from_value_type extractor_type; // doesn't compile
typedef container_type::nth_index<0>::key_from_value_type
extractor_type; // doesn't compile


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