OSVR-Core
inc
osvr
Util
SharedPtr.h
Go to the documentation of this file.
1
12
// Copyright 2014 Sensics, Inc.
13
//
14
// Licensed under the Apache License, Version 2.0 (the "License");
15
// you may not use this file except in compliance with the License.
16
// You may obtain a copy of the License at
17
//
18
// http://www.apache.org/licenses/LICENSE-2.0
19
//
20
// Unless required by applicable law or agreed to in writing, software
21
// distributed under the License is distributed on an "AS IS" BASIS,
22
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
// See the License for the specific language governing permissions and
24
// limitations under the License.
25
26
#ifndef INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C
27
#define INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C
28
29
#if defined(OSVR_SHAREDPTR_USE_BOOST) && defined(OSVR_SHAREDPTR_USE_STD)
30
#error "Can't use both boost and std shared_ptr"
31
#endif
32
33
#if !defined(OSVR_SHAREDPTR_USE_BOOST) && !defined(OSVR_SHAREDPTR_USE_STD)
34
35
#if defined(_MSC_VER)
36
#if (_MSC_VER < 1600)
37
// no std::shared_ptr before VS 2010
38
#define OSVR_SHAREDPTR_USE_BOOST
39
#else
40
#define OSVR_SHAREDPTR_USE_STD
41
#endif
42
43
#elif defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L
44
// GCC and friends in the right mode
45
#define OSVR_SHAREDPTR_USE_STD
46
47
#else
48
// Couldn't guess if we have std::shared_ptr, so assume not.
49
#define OSVR_SHAREDPTR_USE_BOOST
50
#endif // guessing
51
#endif // !defined(OSVR_SHAREDPTR_USE_BOOST) && !defined(OSVR_SHAREDPTR_USE_STD)
52
53
#ifdef OSVR_SHAREDPTR_USE_BOOST
54
#include <boost/shared_ptr.hpp>
55
namespace
osvr
{
56
using
boost::shared_ptr;
57
using
boost::weak_ptr;
58
using
boost::make_shared;
59
using
boost::enable_shared_from_this;
60
}
// namespace osvr
61
62
#else
63
#include <memory>
64
65
namespace
osvr
{
66
using
std::shared_ptr;
67
using
std::weak_ptr;
68
using
std::make_shared;
69
using
std::enable_shared_from_this;
70
}
// namespace osvr
71
#endif
72
73
#endif // INCLUDED_SharedPtr_h_GUID_E9C5BC8D_7D3A_4896_1552_6F4F5292783C
osvr
The main namespace for all C++ elements of the framework, internal and external.
Definition:
namespace_osvr.dox:3
Generated by
1.8.12