|
Boost Users : |
From: René Dalby Carlsen (yg-boost-users_at_[hidden])
Date: 2002-07-23 13:43:41
Hi.
Is there any easy way to get a thread safe edition of the shared_ptr
(BOOST_HAS_THREADS) and a "non" thread safe edition (BOOST_DISABLE_THREADS)
inside the same project?
The thread safe edition of the shared_ptr is a bit slower and I would like
to able to use the non thread safe shared_ptr, when I known it only be used
on the same thread.
As a solution I thought I could do something like this, so I would not have
to edit/copy any boost .hpp file :
//
// MyApp.cpp
//
#define BOOST_HAS_THREADS
#include "boost/smart_ptr.hpp"
namespace boost_nothread
{
#define BOOST_DISABLE_THREADS
#include "boost/smart_ptr.hpp"
}
void f()
{
boost::shared_ptr <int> spIntTS; // thread safe smart pointer
boost_nothread::shared_ptr <int> spInt; // non thread safe smart
pointer
}
////////
The above sample does not work - what should I do instead?
Regards,
René
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net