Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-index] : code fail to compile with VS2010 and boost 1.46.1. Proposed workaround
From: Igor R (boost.lists_at_[hidden])
Date: 2011-05-02 08:41:03


The same, but a bit shorter:

#include <string>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/indexed_by.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/composite_key.hpp>

using namespace boost::multi_index;

struct record
{
  std::string str_;
};

struct test
{
public:
  typedef composite_key<record,
    member<record, std::string, &record::str_>
> key;

  typedef multi_index_container<record,
    indexed_by<ordered_non_unique<key> >
> container;

  void fail_to_compile()
  {
    container c;
    std::string val = "abcd";
    c.equal_range(val);
  }
};


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