strusBase  0.17
shared_ptr.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
9 #ifndef _STRUS_BASE_SHARED_PTR_HPP_INCLUDED
10 #define _STRUS_BASE_SHARED_PTR_HPP_INCLUDED
11 
12 #if __cplusplus >= 201103L
13 #define STRUS_USE_STD_SHARED_PTR
14 #else
15 #undef STRUS_USE_STD_SHARED_PTR
16 #endif
17 
18 #if defined STRUS_USE_STD_SHARED_PTR
19 #include <memory>
20 
21 namespace strus {
22 
23 template <class X>
24 class shared_ptr
25  :public std::shared_ptr<X>
26 {
27 public:
28  shared_ptr( X* ptr)
29  :std::shared_ptr<X>(ptr){}
30  shared_ptr( const shared_ptr& o)
31  :std::shared_ptr<X>(o){}
32  shared_ptr()
33  :std::shared_ptr<X>(){}
34 };
35 } //namespace
36 
37 #else //STRUS_USE_STD_SHARED_PTR
38 
39 #include <boost/shared_ptr.hpp>
40 namespace strus {
41 
42 template <class X>
44  :public boost::shared_ptr<X>
45 {
46 public:
47  shared_ptr( X* ptr)
48  :boost::shared_ptr<X>(ptr){}
50  :boost::shared_ptr<X>(o){}
52  :boost::shared_ptr<X>(){}
53 };
54 } //namespace
55 
56 #endif //STRUS_USE_STD_SHARED_PTR
57 
58 #endif
59 
shared_ptr(X *ptr)
Definition: shared_ptr.hpp:47
shared_ptr(const shared_ptr &o)
Definition: shared_ptr.hpp:49
shared_ptr()
Definition: shared_ptr.hpp:51
Definition: shared_ptr.hpp:43