Stxxl  1.3.2
shared_ptr.h
1 /***************************************************************************
2  * include/stxxl/bits/compat/shared_ptr.h
3  *
4  * compatibility interface to shared_ptr (C++0x, TR1 or boost)
5  *
6  * Part of the STXXL. See http://stxxl.sourceforge.net
7  *
8  * Copyright (C) 2011 Andreas Beckmann <[email protected]>
9  *
10  * Distributed under the Boost Software License, Version 1.0.
11  * (See accompanying file LICENSE_1_0.txt or copy at
12  * http://www.boost.org/LICENSE_1_0.txt)
13  **************************************************************************/
14 
15 #ifndef STXXL_HEADER__COMPAT__SHARED_PTR_H_
16 #define STXXL_HEADER__COMPAT__SHARED_PTR_H_
17 
18 
19 #include <memory>
20 #if defined(__GNUG__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) \
21  && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) \
22  && (!defined(__ICC) || (__ICC >= 1100))
23 #include <tr1/memory>
24 #endif
25 #if defined(STXXL_BOOST_CONFIG)
26 #include <boost/shared_ptr.hpp>
27 #include <boost/make_shared.hpp>
28 #endif
29 
30 #include <stxxl/bits/namespace.h>
31 
32 
33 __STXXL_BEGIN_NAMESPACE
34 
35 #ifndef STXXL_HAVE_SHARED_PTR
36  #define STXXL_HAVE_SHARED_PTR 1
37 #endif
38 
39 #ifndef STXXL_HAVE_MAKE_SHARED
40  #define STXXL_HAVE_MAKE_SHARED 1
41 #endif
42 
43 namespace compat
44 {
45 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
46  using std::shared_ptr;
47  using std::make_shared;
48  using std::allocate_shared;
49 #elif defined(STXXL_BOOST_CONFIG)
50  using boost::shared_ptr;
51  using boost::make_shared;
52  using boost::allocate_shared;
53 #elif defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40200) \
54  && (!defined(__ICC) || (__ICC >= 1100))
55  using std::tr1::shared_ptr;
56  #undef STXXL_HAVE_MAKE_SHARED
57  #define STXXL_HAVE_MAKE_SHARED 0
58 #else
59  // no shared_ptr implementation available
60  #undef STXXL_HAVE_SHARED_PTR
61  #define STXXL_HAVE_SHARED_PTR 0
62  #undef STXXL_HAVE_MAKE_SHARED
63  #define STXXL_HAVE_MAKE_SHARED 0
64 #endif
65 } // namespace compat
66 
67 __STXXL_END_NAMESPACE
68 
69 #endif // !STXXL_HEADER__COMPAT__SHARED_PTR_H_
70 // vim: et:ts=4:sw=4