【问题标题】:boost multi index insert compile errorboost多索引插入编译错误
【发布时间】:2014-03-31 11:20:26
【问题描述】:

我正在尝试在共享内存中创建一个多索引容器,例如 http://www.boost.org/doc/libs/1_55_0/doc/html/interprocess/allocators_containers.html#interprocess.allocators_containers.containers_explained

在我的示例中,我有几个键 IMSI、IMEI、... 我在以下行出现错误

m_pGlobalHash->insert(key);

这里是代码

#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/indexed_by.hpp>

namespace bmi = boost::multi_index;
namespace bip = boost::interprocess;

typedef uint32_t RU32;
typedef uint64_t RU64;

struct SrValue{
    RU32 nVal1;
};

struct UsersKey{
  RU64 IMSI;
  RU64 IMEI;
  SrValue value;
};


struct IMSI_tag{};
struct IMEI_tag{};

typedef bmi::hashed_unique<bmi::tag<IMSI_tag>,
    bmi::member<UsersKey, RU64 , &UsersKey::IMSI>,boost::hash<RU64>, std::equal_to<RU64>
    > hashed_by_IMSI;
typedef bmi::hashed_unique<bmi::tag<IMEI_tag>,
    bmi::member<UsersKey, RU64 , &UsersKey::IMEI>,boost::hash<RU64>, std::equal_to<RU64>
    > hashed_by_IMEI;

//index struc definition
struct UsersKey_hash_indices:
  bmi::indexed_by<
    hashed_by_IMSI,
        hashed_by_IMEI>{};


class CrMultiParameterMultiIndex
{
    typedef boost::multi_index::multi_index_container<
      UsersKey,
      UsersKey_hash_indices,
      bip::allocator<UsersKey,bip::managed_shared_memory::segment_manager>
    > GlobalHash;

    boost::interprocess::offset_ptr<GlobalHash> m_pGlobalHash; 
public:

    void Insert(const UsersKey & key)
    {
        m_pGlobalHash->insert(key);
    }
};

我得到的错误很长,所以这里只是其中的一部分:

    In file included from /hpadir/source/extlibs/boost/boost/interprocess/detail/utilities.hpp:30,
                 from /hpadir/source/extlibs/boost/boost/interprocess/detail/managed_memory_impl.hpp:22,
                 from /hpadir/source/extlibs/boost/boost/interprocess/managed_shared_memory.hpp:21,
                 from implementation/CrMultiParameterMultiIndex.h:29,
                 from implementation/CrMultiParameterMultiIndex.cpp:1:
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp: In instantiation of ‘const bool boost::interprocess::ipcdetail::is_convertible<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > > >*, boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >*>::value’:
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp:60:   instantiated from ‘boost::interprocess::ipcdetail::enable_if<boost::interprocess::ipcdetail::is_convertible<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > > >*, boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >*>, void>’
/hpadir/source/extlibs/boost/boost/multi_index/hashed_index.hpp:703:   instantiated from ‘boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>* boost::multi_index::detail::hashed_index<KeyFromValue, Hash, Pred, SuperMeta, TagList, Category>::insert_(typename boost::call_traits<typename boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>::value_type>::param_type, boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>*) [with KeyFromValue = boost::multi_index::member<UsersKey, long unsigned int, &UsersKey::IMSI>, Hash = boost::hash<long unsigned int>, Pred = std::equal_to<long unsigned int>, SuperMeta = boost::multi_index::detail::nth_layer<1, UsersKey, UsersKey_hash_indices, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<IMSI_tag, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::hashed_unique_tag]’
/hpadir/source/extlibs/boost/boost/multi_index_container.hpp:488:   instantiated from ‘std::pair<typename boost::multi_index::detail::multi_index_base_type<Value, IndexSpecifierList, Allocator>::type::node_type*, bool> boost::multi_index::multi_index_container<Value, IndexSpecifierList, Allocator>::insert_(const Value&) [with Value = UsersKey, IndexSpecifierList = UsersKey_hash_indices, Allocator = boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> >]’
/hpadir/source/extlibs/boost/boost/multi_index/detail/index_base.hpp:150:   instantiated from ‘std::pair<typename boost::multi_index::detail::multi_index_node_type<Value, IndexSpecifierList, Allocator>::type*, bool> boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::final_insert_(typename boost::call_traits<Value>::param_type) [with Value = UsersKey, IndexSpecifierList = UsersKey_hash_indices, Allocator = boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> >]’
/hpadir/source/extlibs/boost/boost/multi_index/hashed_index.hpp:254:   instantiated from ‘std::pair<boost::multi_index::detail::hashed_index_iterator<boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>, boost::multi_index::detail::bucket_array<typename SuperMeta::type::final_allocator_type> >, bool> boost::multi_index::detail::hashed_index<KeyFromValue, Hash, Pred, SuperMeta, TagList, Category>::insert(typename boost::call_traits<typename boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>::value_type>::param_type) [with KeyFromValue = boost::multi_index::member<UsersKey, long unsigned int, &UsersKey::IMSI>, Hash = boost::hash<long unsigned int>, Pred = std::equal_to<long unsigned int>, SuperMeta = boost::multi_index::detail::nth_layer<1, UsersKey, UsersKey_hash_indices, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<IMSI_tag, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::hashed_unique_tag]’
implementation/CrMultiParameterMultiIndex.h:131:   instantiated from here
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp:74: error: ‘boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >’ is an ambiguous base of ‘boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > > >’
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp: In instantiation of ‘boost::interprocess::ipcdetail::enable_if<boost::interprocess::ipcdetail::is_convertible<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > > >*, boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >*>, void>’:
/hpadir/source/extlibs/boost/boost/multi_index/hashed_index.hpp:703:   instantiated from ‘boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>* boost::multi_index::detail::hashed_index<KeyFromValue, Hash, Pred, SuperMeta, TagList, Category>::insert_(typename boost::call_traits<typename boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>::value_type>::param_type, boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>*) [with KeyFromValue = boost::multi_index::member<UsersKey, long unsigned int, &UsersKey::IMSI>, Hash = boost::hash<long unsigned int>, Pred = std::equal_to<long unsigned int>, SuperMeta = boost::multi_index::detail::nth_layer<1, UsersKey, UsersKey_hash_indices, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<IMSI_tag, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::hashed_unique_tag]’
/hpadir/source/extlibs/boost/boost/multi_index_container.hpp:488:   instantiated from ‘std::pair<typename boost::multi_index::detail::multi_index_base_type<Value, IndexSpecifierList, Allocator>::type::node_type*, bool> boost::multi_index::multi_index_container<Value, IndexSpecifierList, Allocator>::insert_(const Value&) [with Value = UsersKey, IndexSpecifierList = UsersKey_hash_indices, Allocator = boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> >]’
/hpadir/source/extlibs/boost/boost/multi_index/detail/index_base.hpp:150:   instantiated from ‘std::pair<typename boost::multi_index::detail::multi_index_node_type<Value, IndexSpecifierList, Allocator>::type*, bool> boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::final_insert_(typename boost::call_traits<Value>::param_type) [with Value = UsersKey, IndexSpecifierList = UsersKey_hash_indices, Allocator = boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> >]’
/hpadir/source/extlibs/boost/boost/multi_index/hashed_index.hpp:254:   instantiated from ‘std::pair<boost::multi_index::detail::hashed_index_iterator<boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>, boost::multi_index::detail::bucket_array<typename SuperMeta::type::final_allocator_type> >, bool> boost::multi_index::detail::hashed_index<KeyFromValue, Hash, Pred, SuperMeta, TagList, Category>::insert(typename boost::call_traits<typename boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>::value_type>::param_type) [with KeyFromValue = boost::multi_index::member<UsersKey, long unsigned int, &UsersKey::IMSI>, Hash = boost::hash<long unsigned int>, Pred = std::equal_to<long unsigned int>, SuperMeta = boost::multi_index::detail::nth_layer<1, UsersKey, UsersKey_hash_indices, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<IMSI_tag, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::hashed_unique_tag]’
implementation/CrMultiParameterMultiIndex.h:131:   instantiated from here
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp:60: error: ‘boost::interprocess::ipcdetail::is_convertible<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > > >*, boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >*>::value’ is not a valid template argument for type ‘bool’ because it is a non-constant expression
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp: In instantiation of ‘const bool boost::interprocess::ipcdetail::is_convertible<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > >*, boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >*>::value’:
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp:60:   instantiated from ‘boost::interprocess::ipcdetail::enable_if<boost::interprocess::ipcdetail::is_convertible<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > >*, boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >*>, void>’
/hpadir/source/extlibs/boost/boost/multi_index/hashed_index.hpp:703:   instantiated from ‘boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>* boost::multi_index::detail::hashed_index<KeyFromValue, Hash, Pred, SuperMeta, TagList, Category>::insert_(typename boost::call_traits<typename boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>::value_type>::param_type, boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>*) [with KeyFromValue = boost::multi_index::member<UsersKey, long unsigned int, &UsersKey::IMEI>, Hash = boost::hash<long unsigned int>, Pred = std::equal_to<long unsigned int>, SuperMeta = boost::multi_index::detail::nth_layer<2, UsersKey, UsersKey_hash_indices, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<IMEI_tag, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::hashed_unique_tag]’
/hpadir/source/extlibs/boost/boost/multi_index/hashed_index.hpp:701:   instantiated from ‘boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>* boost::multi_index::detail::hashed_index<KeyFromValue, Hash, Pred, SuperMeta, TagList, Category>::insert_(typename boost::call_traits<typename boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>::value_type>::param_type, boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>*) [with KeyFromValue = boost::multi_index::member<UsersKey, long unsigned int, &UsersKey::IMSI>, Hash = boost::hash<long unsigned int>, Pred = std::equal_to<long unsigned int>, SuperMeta = boost::multi_index::detail::nth_layer<1, UsersKey, UsersKey_hash_indices, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<IMSI_tag, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::hashed_unique_tag]’
/hpadir/source/extlibs/boost/boost/multi_index_container.hpp:488:   instantiated from ‘std::pair<typename boost::multi_index::detail::multi_index_base_type<Value, IndexSpecifierList, Allocator>::type::node_type*, bool> boost::multi_index::multi_index_container<Value, IndexSpecifierList, Allocator>::insert_(const Value&) [with Value = UsersKey, IndexSpecifierList = UsersKey_hash_indices, Allocator = boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> >]’
/hpadir/source/extlibs/boost/boost/multi_index/detail/index_base.hpp:150:   instantiated from ‘std::pair<typename boost::multi_index::detail::multi_index_node_type<Value, IndexSpecifierList, Allocator>::type*, bool> boost::multi_index::detail::index_base<Value, IndexSpecifierList, Allocator>::final_insert_(typename boost::call_traits<Value>::param_type) [with Value = UsersKey, IndexSpecifierList = UsersKey_hash_indices, Allocator = boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> >]’
/hpadir/source/extlibs/boost/boost/multi_index/hashed_index.hpp:254:   instantiated from ‘std::pair<boost::multi_index::detail::hashed_index_iterator<boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>, boost::multi_index::detail::bucket_array<typename SuperMeta::type::final_allocator_type> >, bool> boost::multi_index::detail::hashed_index<KeyFromValue, Hash, Pred, SuperMeta, TagList, Category>::insert(typename boost::call_traits<typename boost::multi_index::detail::hashed_index_node<typename SuperMeta::type::node_type>::value_type>::param_type) [with KeyFromValue = boost::multi_index::member<UsersKey, long unsigned int, &UsersKey::IMSI>, Hash = boost::hash<long unsigned int>, Pred = std::equal_to<long unsigned int>, SuperMeta = boost::multi_index::detail::nth_layer<1, UsersKey, UsersKey_hash_indices, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TagList = boost::mpl::v_item<IMSI_tag, boost::mpl::vector0<mpl_::na>, 0>, Category = boost::multi_index::detail::hashed_unique_tag]’
implementation/CrMultiParameterMultiIndex.h:131:   instantiated from here
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp:74: error: ‘boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >’ is an ambiguous base of ‘boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > >’
/hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp: In instantiation of ‘boost::interprocess::ipcdetail::enable_if<boost::interprocess::ipcdetail::is_convertible<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > > > >*, boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >*>, void>’:

....

implementation/CrMultiParameterMultiIndex.h:131:   instantiated from here
    /hpadir/source/extlibs/boost/boost/interprocess/detail/mpl.hpp:60: error: ‘boost::interprocess::ipcdetail::is_convertible<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<UsersKey, boost::interprocess::allocator<UsersKey, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > >*, boost::multi_index::detail::hashed_index_node_impl<boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >*>::value’ is not a valid template argument for type ‘bool’ because it is a non-constant expression

如果答案是获取特定索引,然后插入。我应该得到哪个索引,为什么?

【问题讨论】:

  • 您为什么不尝试将您的示例精简到少于 20 行,即显示错误的最低限度?
  • @JohnZwinck :我删除了一些代码,但我留下了多个索引,因为只有一个索引我没有出错。

标签: c++ boost boost-interprocess multi-index


【解决方案1】:

这是 Boost.MultiIndex 的 Boost 1.55 版本中的一个错误,已在即将发布的 Boost 1.56 中修复。您可以在

处查看更完整的问题描述(以及可以在 Boost 1.56 发布之前在本地下载和应用的补丁)

https://svn.boost.org/trac/boost/ticket/9587

【讨论】:

  • 哇!它工作,我不会找到它。我正在使用 boost 1_49,我放了补丁,希望它不会造成问题...
  • 优秀的答案。这是只有Stack Overflow 集中精力的节省时间的类型
  • 提升 1.49?很奇怪,我以为这是在 Boost 1.55 大重构之后引入的回归……很高兴知道。
猜你喜欢
  • 2019-06-10
  • 1970-01-01
  • 2016-11-20
  • 2014-02-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多