2014-03-31 15 views
1

我試圖做多指數容器共享內存就像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 

如果答案是獲得一個特定的指數,然後再插入。我應該得到哪個索引,爲什麼?

+0

你爲什麼不嘗試熬煮的例子不到20行,儘可能顯示錯誤? –

+0

@JohnZwinck:我刪除了一些代碼,但是我留下了多個索引,因爲只有一個索引我沒有錯誤。 – davidbobo

+1

這裏是一個SSCCE:http://coliru.stacked-crooked.com/a/f562d6c6a29d067b – sehe

回答

4

這是Boost.MultiIndex的Boost 1.55版本中的一個錯誤,在即將到來的Boost 1.56中已經修復。你可以看到這個問題有更全面的說明(補丁一起,你可以下載,直到升壓1.56不在本地應用)在

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

+0

哇!它的工作,我不會找到它。我正在與助推1_49,我把補丁,希望它不會造成問題... – davidbobo

+0

優秀的答案。這是隻有[SO]集中的節省時間的類型 – sehe

+0

Boost 1.49?這很奇怪,我認爲這是在Boost 1.55重構之後引入的一種迴歸......很有意思。 –