0
我試圖創建一個進程間共享內存,我有一個編譯錯誤錯誤地圖shared_memory提高
這裏駐留的問題是代碼:
typedef bip::basic_string< char,std::char_traits<char>,
bip::allocator<char,bip::managed_mapped_file::segment_manager> > shared_string;
typedef shared_string MappedType;
typedef shared_string MappedType;
typedef const int KeyType;
typedef std::pair<const int, shared_string> ValueType;
//Alias a map of ints that uses the previous STL-like allocator.
//Note that the third parameter argument is the ordering function
//of the map, just like with std::map, used to compare the keys.
typedef bip::map<KeyType, MappedType, std::less<KeyType>, ShmemAllocator> MyMap;
mymap =
seg->find_or_construct<MyMap>("MyMap") //object name
(std::less<int>() //first constructor parameter
,*alloc_inst);
,我有問題,創建地圖。錯誤是:
c:\GQSDevEnv\3rdParty\boost\boost_1_36_0\boost\interprocess\containers\map.hpp(437) : error C2535: 'std::pair<_Ty1,_Ty2> boost::interprocess::map<Key,T,Pred,Alloc>::insert(const boost::interprocess::map<Key,T,Pred,Alloc>::value_type &)' : member function already defined or declared
with
[
_Ty1=boost::interprocess::detail::rbtree<const Testing::KeyType,std::pair<const int,Testing::shared_string>,boost::interprocess::detail::select1st<std::pair<const int,Testing::shared_string>>,std::less<const Testing::KeyType>,Testing::ShmemAllocator>::iterator,
_Ty2=bool,
Key=const Testing::KeyType,
T=Testing::MappedType,
Pred=std::less<const Testing::KeyType>,
Alloc=Testing::ShmemAllocator
]
我必須聲明不同嗎?我工作的時候,當我在std :: pair中輸入一個Template的類型名稱,但是現在我想嘗試只輸入一個int ...我不知道爲什麼會出現這個錯誤...
感謝致歉
因爲我只想修改一個使用此代碼的模板......我想我可能需要定義其他的東西。但我不知道是什麼:(... – david 2011-02-02 16:59:44