Subject: [Boost-bugs] [Boost C++ Libraries] #10011: segment_manager::find( unique_instance_t* ) fails to compile
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-06 16:31:10
#10011: segment_manager::find( unique_instance_t* ) fails to compile
---------------------------------------------+--------------------------
Reporter: Michael Smolensky <smolensky@â¦> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.55.0 | Severity: Problem
Keywords: |
---------------------------------------------+--------------------------
When called directly (not from managed_memory_impl),
segment_manager::find( unique_instance_t* ) fails to compile. Both v 1.53,
1.55, and 1.55b have this issue.
The fix would be either:
- to remove segment_manager::find( unique_instance_t* ) and replace
find( const CharType* ) with find( char_ptr_holder_t ) or
- to fix priv_find_impl( unique_instance* ): in line 742 replace name with
typeid(T).name()
void *ret = priv_generic_find<char>(name, m_header.m_unique_index,
table, size, is_intrusive_t(), lock);
with
void *ret = priv_generic_find<char>(typeid(T).name(),
m_header.m_unique_index, table, size, is_intrusive_t(), lock);
Below is a test program and VC11 error:
{{{
#include <boost/interprocess/indexes/flat_map_index.hpp>
#include <boost/interprocess/mem_algo/simple_seq_fit.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/segment_manager.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/sync/mutex_family.hpp>
int main()
{
using namespace boost::interprocess;
typedef simple_seq_fit< null_mutex_family > AllocAlgo;
typedef segment_manager< char, AllocAlgo, flat_map_index > MemManager;
shared_memory_object sh_mem( create_only, "test", read_write );
sh_mem.truncate( 1000 );
mapped_region mapping( sh_mem, read_write );
MemManager* mem_mgr = new( mapping.get_address() ) MemManager( 1000 );
mem_mgr->construct< int >( unique_instance );
int* p = mem_mgr->find< int >( unique_instance ).first;
return 0;
}
}}}
1> main.cpp
1>c:\dev\exb++.libs\boost\1.55.0b0\common\include\boost\interprocess\segment_manager.hpp(430):
error C2664: 'std::pair<_Ty1,_Ty2>
boost::interprocess::segment_manager<CharType,MemoryAlgorithm,IndexType>::priv_find_impl<T>(const
CharType *,bool)' : cannot convert parameter 1 from 'const
boost::interprocess::ipcdetail::unique_instance_t *' to 'const char *'
1> with
1> [
1> _Ty1=int *,
1> _Ty2=unsigned int,
1> CharType=char,
1> MemoryAlgorithm=AllocAlgo,
1> IndexType=boost::interprocess::flat_map_index,
1> T=int
1> ]
1> Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
1> c:\prj\boostinterprocess\main.cpp(21) : see reference to
function template instantiation 'std::pair<_Ty1,_Ty2>
boost::interprocess::segment_manager<CharType,MemoryAlgorithm,IndexType>::find<int>(const
boost::interprocess::ipcdetail::unique_instance_t *)' being compiled
1> with
1> [
1> _Ty1=int *,
1> _Ty2=unsigned int,
1> CharType=char,
1> MemoryAlgorithm=AllocAlgo,
1> IndexType=boost::interprocess::flat_map_index
1> ]
1> c:\prj\boostinterprocess\main.cpp(21) : see reference to
function template instantiation 'std::pair<_Ty1,_Ty2>
boost::interprocess::segment_manager<CharType,MemoryAlgorithm,IndexType>::find<int>(const
boost::interprocess::ipcdetail::unique_instance_t *)' being compiled
1> with
1> [
1> _Ty1=int *,
1> _Ty2=unsigned int,
1> CharType=char,
1> MemoryAlgorithm=AllocAlgo,
1> IndexType=boost::interprocess::flat_map_index
1> ]
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10011> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC