Reputation: 383
I am having problem to define a subclass member as index member
Is this possible
For the following code
namespace bmi = boost::multi_index;
namespace bip = boost::interprocess;
struct UsersKey {
uint64_t IMSI;
};
struct UsersVal {
uint64_t IMSI;
};
struct HashEntry{
UsersKey key;
UsersVal val;
}
typedef bmi::hashed_unique<bmi::tag<struct IMSI_tag>, bmi::member<HashEntry, uint64_t , &HashEntry::UsersKey::IMSI>, boost::hash<uint64_t>, std::equal_to<uint64_t> > hashed_by_IMSI;
typedef
bmi::indexed_by< hashed_by_IMSI > UsersKey_hash_indices;
typedef boost::multi_index::multi_index_container<
HashEntry,
UsersKey_hash_indices>
> GlobalHash;
I get the following error
error: no member named 'UsersKey' in 'HashEntry'; did you mean simply 'UsersKey'?
Here is a link to online code http://coliru.stacked-crooked.com/a/d736557edf615fc2
Upvotes: 0
Views: 104
Reputation: 5658
The C++ pointer to member function syntax does not allow to designate members inside members as you intend to do here. One simple option is to use the provided global_fun
key extractor as shown at http://coliru.stacked-crooked.com/a/c57625bfb1d5acfa
Best,
Upvotes: 1