Re: [Boost-users] How to use boost's shared_ptr.hpp?
On Jul 12, 2008, at 2:28 AM, boost-users-request@lists.boost.org wrote:
On Fri, Jul 11, 2008 at 6:06 PM, Igor R
wrote: Does it compile if you define BOOST_NO_TYPEID ?
My question is why I need to enable 'rtti' in order to use boost shared_ptr ?
IIRC, get_deleter() function uses typeid(), which is unavailable in your case.
I have added '#define BOOST_NO_TYPEID ' Before I include 'shared_ptr.hpp', but i still get the following error:
/usr/include/boost/detail/sp_counted_impl.hpp: In member function 'virtual void* boost::detail::sp_counted_impl_pd
::get_deleter(const std::type_info&)': /usr/include/boost/detail/sp_counted_impl.hpp:150: error: cannot use typeid with -fno-rtti
#define BOOST_NO_TYPEID #include
using namespace std; using namespace boost;
Can you please tell me if there is a way to use boost smart pointer without rtti? Thank you.
Actually, it isn't clear to me that you CAN use shared_ptr without RTTI. The shared_ptr package (both boost and TR1) includes dynamic_pointer_cast and static_pointer_cast, which are RTTI-related functions. Perhaps if you could share with us why it is important to use the -fno- rtti switch in your work, someone could provide more substantive suggestions. Cheers, Rick Aurbach
On Sat, Jul 12, 2008 at 10:43 AM, Richard L. Aurbach
On Jul 12, 2008, at 2:28 AM, boost-users-request@lists.boost.org wrote:
On Fri, Jul 11, 2008 at 6:06 PM, Igor R
wrote: Does it compile if you define BOOST_NO_TYPEID ?
My question is why I need to enable 'rtti' in order to use boost shared_ptr ?
IIRC, get_deleter() function uses typeid(), which is unavailable in your case.
I have added '#define BOOST_NO_TYPEID ' Before I include 'shared_ptr.hpp', but i still get the following error:
/usr/include/boost/detail/sp_counted_impl.hpp: In member function 'virtual void* boost::detail::sp_counted_impl_pd
::get_deleter(const std::type_info&)': /usr/include/boost/detail/sp_counted_impl.hpp:150: error: cannot use typeid with -fno-rtti
#define BOOST_NO_TYPEID #include
using namespace std; using namespace boost;
Can you please tell me if there is a way to use boost smart pointer without rtti? Thank you.
Actually, it isn't clear to me that you CAN use shared_ptr without RTTI. The shared_ptr package (both boost and TR1) includes dynamic_pointer_cast and static_pointer_cast, which are RTTI-related functions. Perhaps if you could share with us why it is important to use the -fno-rtti switch in your work, someone could provide more substantive suggestions. Cheers, Rick Aurbach
My understanding is '-fno-rtti switch' will result in smaller memory usage in my code. And it is part of a legacy project, so the whole project is compiled with '-fno-rtti', I don't know how to change the Makefile.in to not use that switch for only my part of the project (in its own directory and with its own Makefile.in).
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Meryl Silverburgh
-
Richard L. Aurbach