Thanks Joaquin,<br>I will try it out, I really got frustated with Managed C++ 'cause it was not allowing me to use stl and boost containers with the managed objects. Its actually because the GC has to shuffle the objects around so its not possible to get the address of member variable and/or proc. <br><br>I guess what I have to do is write a nogc wrapper just like what you have pointed out and use pinned pointers. <br><br>Regards<br>Parag<br><br><br><div><span class="gmail_quote">On 4/7/06, <b class="gmail_sendername"> Joaqu�n M� L�pez Mu�oz</b> <<a href="mailto:joaquin@tid.es">joaquin@tid.es</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div style="direction: ltr;"> <p>Parag Gadkari ha escrito: </p></div><div style="direction: ltr;"><span class="e" id="q_10a74bbd7d6b0bc9_1"><blockquote type="CITE">I am having trouble while using multi index container with the "managed c++" component. Here is the typedef that the compiler won't accept. <br> <pre><span>typedef</span> <span> multi_index_container</span><span><</span> <span>gcroot<</span><span>int</span>erface<span>_entity*></span><span>,</span> <span>indexed_by</span><span><</span> <span></span> <span>ordered_unique</span><span><</span><span> identity</span><span><gcroot<</span><span>interface_entity*> </span><span>></span> <span>>,</span> <span>ordered_non_unique<br></span><span><</span><span>member</span><span><</span><span>gcroot<</span><span>interface_entity*></span><span> , </span><span>int</span><span></span><span>,&</span><span>interface_entity</span><span>::entity_drawingid</span><span> </span><span>></span> <span>>,</span> <span>></span> <span>></span> <span>entity_collection;</span></pre> The real deal is with the member template which needs the address of member variable of the interface_entity class. Entity class is an abstract Managed type (specified with __gc), and it is not allowed to take the address of a non-static member of a managed type. <p>Does anybody know of a workaround? <br> </p></blockquote></span></div><div style="direction: ltr;"> Hello Parag, <p>A simple solution is to write a custom key extractor as described at: </p><p><a href="http://tinyurl.com/l3g6u" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://tinyurl.com/l3g6u</a> </p><p>In your particular case, the extractor would look like the following <br>(warning, uncompiled): </p><p>struct entity_drawingid_extractor <br>{ <br> typedef int result_type; <br> <br> result_type operator()(const gcroot<interface_entity*>& x)const <br> { <br> return x->entity_drawingid; <br> } <br>}; </p><p>Does this help? Is this the only problem you've stumbled upon when <br>using B.MI with Managed C++? I'm curious as reports of usage of <br>Boost libs in .NET C++-like languages are scarce. </p><p>Joaqu�n M L�pez Mu�oz <br>Telef�inca, Investigaci�n y Desarrollo <br> </p><p></p><p></p><p></p><p></p><p></p><p></p></div><br>_______________________________________________<br>Boost-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Boost-users@lists.boost.org"> Boost-users@lists.boost.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users </a><br><br></blockquote></div><br>