|
Boost Users : |
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2004-12-14 02:35:00
Jia Pu <very.funny.j <at> gmail.com> 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 <boost/multi_index_container.hpp>
#include <boost/multi_index/key_extractors.hpp>
#include <boost/multi_index/ordered_index.hpp>
#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<by_id>,
BOOST_MULTI_INDEX_MEMBER(StringIdPair, int, id) >,
ordered_unique<
tag<by_symbol>,
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;
}
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