|
Boost Users : |
From: Sunil Chomal (sunilchomal_at_[hidden])
Date: 2006-12-11 09:01:09
Dear All,
I am a newbie with multi_index container. I need to store the following data
structure in the multi_index_container:
*************************************
#if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
using boost::multi_index_container;
using namespace boost::multi_index;
struct base
{
int base_data;
};
struct child : public base
{
int child_data;
};
struct base_data{ };
typedef multi_index_container
<
child,
indexed_by<
ordered_non_unique< tag<base_data>,
BOOST_MULTI_INDEX_MEMBER(child, int, base_data) >
>
> child_set;
int main()
{
child_set cs;
return 0;
}
***************************************
If i try and compile the above code, I get the following error
test.cpp:33: error: could not convert template argument &base::base_data to
int child::*
test.cpp:33: error: template argument 2 is invalid
test.cpp:34: error: template argument 1 is invalid
test.cpp:35: error: template argument 2 is invalid
test.cpp:35: error: invalid type in declaration before ; token
I have looked up the examples, but I can find any example for structs which
are inherited.
Can someone help?
Regards,
Sunil
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