I forgot to include ordered_index.hpp. I thought including multi_index_container.hpp will give me everything I need. Thank you.
From: Joaquin M Lopez Munoz
Subject: [Boost-users] Re: Boost-1-32 multi_index compilation error on msvc6. To: boost-users@lists.boost.org Message-ID: Content-Type: text/plain; charset=utf-8 Jia Pu
writes: I am using MSVC 6 with Boost 1-32. Below is my sample code using two indeices:
[...]
When I compile it, I have following errors. The actual message is much longer than this. I don't want paste them here to piss off every one on this mailing list. :)
Anyway, I am not a template expert. I couldn't figure it out myself. Any help will be appreciated. Thanks.
Hi,
I cannot see what could be going wrong with your example. The attached complete program compiles OK here with MSVC 6.0 + SP5. Maybe you can post some complete code that exhibits the problem?
JoaquÃn M López Muñoz Telefónica, Investigación y Desarrollo
#include
#include #include #include <string> struct by_id{}; struct by_symbol{};
struct StringIdPair { StringIdPair(int _id, const std::string & _string): id(_id), string(_string) {}
int id; std::string string; };
using namespace boost::multi_index;
typedef multi_index_container< StringIdPair, indexed_by< ordered_unique< tag
, BOOST_MULTI_INDEX_MEMBER(StringIdPair, int, id) >, ordered_unique< tag , BOOST_MULTI_INDEX_MEMBER(StringIdPair, std::string, string) > StringIdTable;
int main() { StringIdTable string_id_table;
string_id_table.insert(StringIdPair(0,"zero")); string_id_table.insert(StringIdPair(1,"one")); string_id_table.insert(StringIdPair(2,"two"));
return 0; }