Files
pvData/pvDataApp/misc/sharedPtr.h
Michael Davidsaver 899c22fbf8 tr1 shared_ptr
2011-03-07 12:23:51 -05:00

62 lines
1.2 KiB
C++

/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef SHAREDPTR_H
#define SHAREDPTR_H
/*
* Pulls in the std::tr1 namespace with the following names
*
* class shared_ptr
* class weak_ptr
* class bad_weak_ptr
* function static_pointer_cast;
* function dynamic_pointer_cast
* function const_pointer_cast
* function swap
* function get_deleter
* function enable_shared_from_this
*/
// where should we look?
#if defined(__GNUC__) && __GNUC__>=4
// GCC >=4.0.0
# define SHARED_FROM_TR1
#elif defined(_MSC_VER) && (_MSC_VER>1500 || defined(_HAS_TR1))
// MSVC > 2008, or 2008 w/ SP1
# define SHARED_FROM_TR1
#else
# define SHARED_FROM_BOOST
#endif
// go and get it
#if defined(SHARED_FROM_TR1)
# include <tr1/memory>
#elif defined(SHARED_FROM_BOOST)
# include <boost/tr1/memory.hpp>
#else
// eventually...
# include <memory>
#endif
// cleanup
#ifdef SHARED_FROM_TR1
# undef SHARED_FROM_TR1
#endif
#ifdef SHARED_FROM_BOOST
# undef SHARED_FROM_BOOST
#endif
#endif // SHAREDPTR_H