|
Boost Users : |
Subject: [Boost-users] [MultiIndex] strange problem with simple use of member key extractor
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2013-01-17 19:28:15
namespace bmi = boost::multi_index;
....
bmi::ordered_non_unique<
bmi::member<
ItemBase,
unsigned,
&ItemBase::my_member
>
>, // ordered_non_unique
....
I'm getting a compiler error on VS10 from
template<class Class,typename Type,Type Class::*PtrToMember>
struct non_const_member_base
{
....
Type&
operator()(const ChainedPtr& x)const
{
return operator()(*x);
}
boost/multi_index/member.hpp(105): error C2440: 'return' : cannot convert from 'const
unsigned int' to 'unsigned int &'
It also tells me that the ChainedPtr is a shared_ptr to a const ItemBase,
and I can see that _none_ of the operator()'s in that class return a non-reference. But
if the compiler is already thinking ref-becomes-lvalue and leaves that out, the next form
const Type& operator()(const Class& x,int=0)const
{
return x.*PtrToMember;
}
is a perfect match to *x and so I expect the return value to be in fact const (because the
object being dereferencd was const)
Any idea what's going on here, and what I might do about it?
Our project is using Boost 1.49, though I didn't see anything in the release notes about
changes to MultiIndex in later releases.
âJohn
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