Boost C++ Libraries: Ticket #10011: segment_manager::find( unique_instance_t* ) fails to compile https://svn.boost.org/trac10/ticket/10011 <p> 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. </p> <p> The fix would be either: </p> <ul><li>to remove segment_manager::find( unique_instance_t* ) and replace </li></ul><p> find( const <a class="missing wiki">CharType</a>* ) with find( char_ptr_holder_t ) or </p> <ul><li>to fix priv_find_impl( unique_instance* ): in line 742 replace name with typeid(T).name() </li></ul><blockquote> <p> void *ret = priv_generic_find&lt;char&gt;(name, m_header.m_unique_index, table, size, is_intrusive_t(), lock); </p> </blockquote> <p> with </p> <blockquote> <p> void *ret = priv_generic_find&lt;char&gt;(typeid(T).name(), m_header.m_unique_index, table, size, is_intrusive_t(), lock); </p> </blockquote> <p> Below is a test program and VC11 error: </p> <pre class="wiki">#include &lt;boost/interprocess/indexes/flat_map_index.hpp&gt; #include &lt;boost/interprocess/mem_algo/simple_seq_fit.hpp&gt; #include &lt;boost/interprocess/mapped_region.hpp&gt; #include &lt;boost/interprocess/segment_manager.hpp&gt; #include &lt;boost/interprocess/shared_memory_object.hpp&gt; #include &lt;boost/interprocess/sync/mutex_family.hpp&gt; int main() { using namespace boost::interprocess; typedef simple_seq_fit&lt; null_mutex_family &gt; AllocAlgo; typedef segment_manager&lt; char, AllocAlgo, flat_map_index &gt; 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-&gt;construct&lt; int &gt;( unique_instance ); int* p = mem_mgr-&gt;find&lt; int &gt;( unique_instance ).first; return 0; } </pre><p> 1&gt; main.cpp 1&gt;c:\dev\exb++.libs\boost\1.55.0b0\common\include\boost\interprocess\segment_manager.hpp(430): error C2664: 'std::pair&lt;_Ty1,_Ty2&gt; boost::interprocess::segment_manager&lt;<a class="missing wiki">CharType</a>,<a class="missing wiki">MemoryAlgorithm</a>,<a class="missing wiki">IndexType</a>&gt;::priv_find_impl&lt;T&gt;(const <a class="missing wiki">CharType</a> *,bool)' : cannot convert parameter 1 from 'const boost::interprocess::ipcdetail::unique_instance_t *' to 'const char *' 1&gt; with 1&gt; [ 1&gt; _Ty1=int *, 1&gt; _Ty2=unsigned int, 1&gt; <a class="missing wiki">CharType</a>=char, 1&gt; <a class="missing wiki">MemoryAlgorithm</a>=<a class="missing wiki">AllocAlgo</a>, 1&gt; <a class="missing wiki">IndexType</a>=boost::interprocess::flat_map_index, 1&gt; T=int 1&gt; ] 1&gt; Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1&gt; c:\prj\boostinterprocess\main.cpp(21) : see reference to function template instantiation 'std::pair&lt;_Ty1,_Ty2&gt; boost::interprocess::segment_manager&lt;<a class="missing wiki">CharType</a>,<a class="missing wiki">MemoryAlgorithm</a>,<a class="missing wiki">IndexType</a>&gt;::find&lt;int&gt;(const boost::interprocess::ipcdetail::unique_instance_t *)' being compiled 1&gt; with 1&gt; [ 1&gt; _Ty1=int *, 1&gt; _Ty2=unsigned int, 1&gt; <a class="missing wiki">CharType</a>=char, 1&gt; <a class="missing wiki">MemoryAlgorithm</a>=<a class="missing wiki">AllocAlgo</a>, 1&gt; <a class="missing wiki">IndexType</a>=boost::interprocess::flat_map_index 1&gt; ] 1&gt; c:\prj\boostinterprocess\main.cpp(21) : see reference to function template instantiation 'std::pair&lt;_Ty1,_Ty2&gt; boost::interprocess::segment_manager&lt;<a class="missing wiki">CharType</a>,<a class="missing wiki">MemoryAlgorithm</a>,<a class="missing wiki">IndexType</a>&gt;::find&lt;int&gt;(const boost::interprocess::ipcdetail::unique_instance_t *)' being compiled 1&gt; with 1&gt; [ 1&gt; _Ty1=int *, 1&gt; _Ty2=unsigned int, 1&gt; <a class="missing wiki">CharType</a>=char, 1&gt; <a class="missing wiki">MemoryAlgorithm</a>=<a class="missing wiki">AllocAlgo</a>, 1&gt; <a class="missing wiki">IndexType</a>=boost::interprocess::flat_map_index 1&gt; ] </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10011 Trac 1.4.3 Ion Gaztañaga Mon, 02 Jun 2014 12:43:39 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10011#comment:1 https://svn.boost.org/trac10/ticket/10011#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Thanks for the report. Fixed in: </p> <p> [develop aa09229] Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10011" title="#10011: Bugs: segment_manager::find( unique_instance_t* ) fails to compile (closed: fixed)">#10011</a> segment_manager::find( unique_instance_t* ) fails to compile </p> <blockquote> <p> 9 files changed, 692 insertions(+), 101 deletions(-) create mode 100644 proj/vc7ide/segment_manager_test.vcproj create mode 100644 test/segment_manager_test.cpp </p> </blockquote> Ticket