tr1 shared_ptr

This commit is contained in:
Michael Davidsaver
2011-03-02 18:08:38 -05:00
parent 14c1fdc8c1
commit 899c22fbf8
2 changed files with 62 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ INC += queue.h
INC += messageQueue.h
INC += destroyable.h
INC += status.h
INC += sharedPtr.h
LIBSRCS += CDRMonitor.cpp
LIBSRCS += byteBuffer.cpp

View File

@@ -0,0 +1,61 @@
/**
* 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