|
Boost Users : |
Subject: [Boost-users] A[MultiIndex] Erasing boost MultiIndex entry
From: ishay lavi (ishaylavi_at_[hidden])
Date: 2010-02-08 13:31:36
Hello!
dose anyone can help me with deletion of MultiIndex container? (boost lib 1.38.0 with MSVC 2005)
At the 'erase()' calling I get the following compilation errors:
error C2663: 'boost::multi_index::detail::ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>::erase' : 3 overloads have no legal conversion for 'this' pointer
with
[
KeyFromValue=boost::multi_index::member<my_class::RemoveManagerRelatedLegs::ItemIndex,char [64],pointer-to-member(0x0)>,
Compare=my_class::my_func::ItemIndex::ItemName,
SuperMeta=boost::multi_index::detail::nth_layer<1my_class::my_func::ItemIndex,boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::tag<my_class::my_func::ItemIndex::ItemName>,boost::multi_index::member<my_class::my_func::ItemIndex,char [64],pointer-to-member(0x0)>,my_class::my_func::ItemIndex::ItemName>,boost::multi_index::ordered_non_unique<boost::multi_index::tag<my_class::my_func::ItemIndex::ItemGroup>,boost::multi_index::member<my_class::my_func::ItemIndex,char [64],pointer-to-member(0x40)>,my_class::my_func::ItemIndex::ItemGroup>>,std::allocator<my_class::my_func::ItemIndex>>,
TagList=boost::mpl::vector1<my_class::my_func::ItemIndex::ItemName>,
Category=boost::multi_index::detail::ordered_unique_tag
]
error C2663: 'boost::multi_index::detail::ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>::erase' : 3 overloads have no legal conversion for 'this' pointer
with
[
KeyFromValue=boost::multi_index::member<my_class::my_func::ItemIndex,char [64],pointer-to-member(0x40)>,
Compare=my_class::my_func::ItemIndex::ItemGroup,
SuperMeta=boost::multi_index::detail::nth_layer<2,my_class::my_func::ItemIndex,boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::tag<my_class::my_func::ItemIndex::ItemName>,boost::multi_index::member<my_class::my_func::ItemIndex,char [64],pointer-to-member(0x0)>,my_class::my_func::ItemIndex::ItemName>,boost::multi_index::ordered_non_unique<boost::multi_index::tag<my_class::my_func::ItemIndex::ItemGroup>,boost::multi_index::member<my_class::my_func::ItemIndex,char [64],pointer-to-member(0x40)>,my_class::my_func::ItemIndex::ItemGroup>>,std::allocator<my_class::my_func::ItemIndex>>,
TagList=boost::mpl::vector1<my_class::my_func::ItemIndex::ItemGroup>,
Category=boost::multi_index::detail::ordered_non_unique_tag
]
My code are as following
//========================================================================
class ItemIndex
{
public:
char chItemName[64];
struct ItemName
{
bool operator()(const char* pch1, const char* pch2) const { return ( strcmp(pch1, pch2) < 0 ); }
};
char chItemGroup[64];
struct ItemGroup
{
bool operator()(const char* pch1, const char* pch2) const { return ( strcmp(pch1, pch2) < 0 ); }
};
};
//Definition of Multi-index containers
typedef boost::multi_index_container
< ItemIndex
, boost::multi_index::indexed_by
< boost::multi_index::ordered_unique //Set indexing
< boost::multi_index::tag <ItemIndex::ItemName> //Tagging
, boost::multi_index::member <ItemIndex, char[64], &ItemIndex::chItemName>
, ItemIndex::ItemName //Comparison predicate
>
, boost::multi_index::ordered_non_unique //Multiset indexing
< boost::multi_index::tag <ItemIndex::ItemGroup> //Tagging
, boost::multi_index::member <ItemIndex, char[64], &ItemIndex::chItemGroup>
, ItemIndex::ItemGroup //Comparison predicate
>
>
> typeItemsIndexingContainer;
typeItemsIndexingContainer my_indexing;
ItemIndex item1 = {"I1", "G1"};
ItemIndex item2 = {"I2", "G1"};
my_indexing.insert( item1 );
my_indexing.insert( item2 );
const typeItemsIndexingContainer::index<ItemIndex::ItemName>::type& indexItemName = my_indexing.get<ItemIndex::ItemName>();
typeItemsIndexingContainer::index<ItemIndex::ItemName>::type::iterator itName = indexItemName.find( item1.chItemName );
indexItemName.erase( itName );
const typeItemsIndexingContainer::index<ItemIndex::ItemGroup>::type& indexItemGroup = my_indexing.get<ItemIndex::ItemGroup>();
typeItemsIndexingContainer::index<ItemIndex::ItemGroup>::type::iterator itGroup = indexItemGroup.find( item1.chItemGroup );
indexItemGroup.erase( itGroup );
//========================================================================
Thanks!
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