Hi,
I'm trying to store these classes in a multi_index:
struct Foo
{
int a;
};
struct Bar
:Foo
{
};
typedef multi_index_container<
Bar,
indexed_by<
ordered_unique<
member
Bar_container;
Notice I have to use "Foo" in the "member<" line.
However, even with this, when trying to do a search:
Bar_container bar_container;
int function()
{
Bar_container::nth_index<0>::type& a_index =
bar_container.get<0>();
Bar_container::nth_index<0>::type::iterator i =
a_index.find(5);
if (i != a_index.end())
return -1;
return 0;
}
I get this:
/usr/include/boost/multi_index/member.hpp: In member
function 'Type&
boost::multi_index::detail::non_const_member_base , KeyFromValue = boost::multi_index::member I've tried a few alternatives such as providing a
custom compare function
but I always get this error. It seems to have
something to do with the
fact that the key is in the base class. If I move the
key to the derived
class (and change the "member<" line), it works fine.
Surely there's a way to do this. Anyone know how ?
Using gcc version 4.1.2 20061115 (prerelease) (Debian
4.1.1-21) and
libboost 1.33.1.
Thanks
___________________________________________________________
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk