共有メモリに保存されているboost::interprocess::mapにいくつかの値を挿入しようとしています。
問題は、コンパイルしようとすると「オーバーロードされた関数へのあいまいな呼び出し」が発生することですが、その理由はわかりません。コードスニペットは次のとおりです。
#include <boost/interprocess/containers/map.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
typedef char * KeyType;
typedef long ValueType;
typedef std::pair<const char *, long> Type_Value;
typedef boost::interprocess::allocator<Type_Value, boost::interprocess::managed_shared_memory::segment_manager> ShmemAllocator;
typedef boost::interprocess::map<KeyType, ValueType, std::less<KeyType>, ShmemAllocator> MyMap;
...
MyMap * myMap = segment.construct<MyMap>("CyValoresRTD") //object name
(std::less<char *>() //first ctor parameter
,alloc_inst); //second ctor parameter
...
char * text = "some text";
long value = 1234;
myMap->insert( std::make_pair(text, value) );
この挿入呼び出しは私にいくつかのエラーを与えます:
vcrtdserverimpl.cpp(445) : error C2668: 'boost::interprocess_container::map<Key,T,Pred,Alloc>::insert' : ambiguous call to overloaded function
with
[
Key=VCRTDServer::KeyType,
T=VCRTDServer::ValueType,
Pred=std::less<VCRTDServer::KeyType>,
Alloc=VCRTDServer::ShmemAllocator
]
p:\lib\boost_1_39_0\boost\interprocess\containers\container\map.hpp(407): could be 'std::pair<_Ty1,_Ty2> boost::interprocess_container::map<Key,T,Pred,Alloc>::insert(const std::pair<char *,long> &)'
with
[
_Ty1=boost::interprocess_container::containers_detail::rbtree<VCRTDServer::KeyType ,std::pair<const VCRTDServer::KeyType ,VCRTDServer::ValueType>,boost::interprocess_container::containers_detail::select1st<std::pair<const VCRTDServer::KeyType ,VCRTDServer::ValueType>>,std::less<VCRTDServer::KeyType>,VCRTDServer::ShmemAllocator>::iterator,
_Ty2=bool,
Key=VCRTDServer::KeyType,
T=VCRTDServer::ValueType,
Pred=std::less<VCRTDServer::KeyType>,
Alloc=VCRTDServer::ShmemAllocator
]
p:\lib\boost_1_39_0\boost\interprocess\containers\container\map.hpp(396): or 'std::pair<_Ty1,_Ty2> boost::interprocess_container::map<Key,T,Pred,Alloc>::insert(const std::pair<const Key,T> &)'
with
[
_Ty1=boost::interprocess_container::containers_detail::rbtree<VCRTDServer::KeyType ,std::pair<const VCRTDServer::KeyType ,VCRTDServer::ValueType>,boost::interprocess_container::containers_detail::select1st<std::pair<const VCRTDServer::KeyType ,VCRTDServer::ValueType>>,std::less<VCRTDServer::KeyType>,VCRTDServer::ShmemAllocator>::iterator,
_Ty2=bool,
Key=VCRTDServer::KeyType,
T=VCRTDServer::ValueType,
Pred=std::less<VCRTDServer::KeyType>,
Alloc=VCRTDServer::ShmemAllocator
]
while trying to match the argument list '(std::pair<_Ty1,_Ty2>)'
with
[
_Ty1=char *,
_Ty2=int
]
誰かアイデアはありますか?