File tree Expand file tree Collapse file tree 3 files changed +50
-5
lines changed Expand file tree Collapse file tree 3 files changed +50
-5
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 2.8.12) # version on Ubuntu Trusty
2
2
project (behaviortree_cpp_v3 )
3
3
4
4
if (NOT CMAKE_VERSION VERSION_LESS 3.1 )
5
- set (CMAKE_CXX_STANDARD 14 )
5
+ set (CMAKE_CXX_STANDARD 11 )
6
6
set (CMAKE_CXX_STANDARD_REQUIRED ON )
7
7
else ()
8
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 " )
8
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 " )
9
9
endif ()
10
10
11
11
if (MSVC )
Original file line number Diff line number Diff line change 9
9
#include < typeinfo>
10
10
#include < functional>
11
11
#include < chrono>
12
+ #include < memory>
12
13
#include " behaviortree_cpp/utils/string_view.hpp"
13
14
#include " behaviortree_cpp/utils/safe_any.hpp"
14
15
#include " behaviortree_cpp/exceptions.h"
15
16
#include " behaviortree_cpp/utils/expected.hpp"
17
+ #include " behaviortree_cpp/utils/make_unique.hpp"
16
18
17
19
namespace BT
18
20
{
@@ -336,9 +338,6 @@ PortsList getProvidedPorts(enable_if_not< has_static_method_providedPorts<T> > =
336
338
typedef std::chrono::high_resolution_clock::time_point TimePoint;
337
339
typedef std::chrono::high_resolution_clock::duration Duration;
338
340
339
-
340
-
341
-
342
341
} // end namespace
343
342
344
343
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+
3
+ #include < memory>
4
+
5
+ // https://en.cppreference.com/w/cpp/feature_test
6
+ #if not __has_cpp_attribute(__cpp_lib_make_unique)
7
+
8
+ // The compiler doesn't provide it, so implement it ourselves.
9
+
10
+ #include < cstddef>
11
+ #include < memory>
12
+ #include < type_traits>
13
+ #include < utility>
14
+
15
+ namespace std {
16
+
17
+ template <class _Ty > struct _Unique_if {
18
+ typedef unique_ptr<_Ty> _Single_object;
19
+ };
20
+
21
+ template <class _Ty > struct _Unique_if <_Ty[]> {
22
+ typedef unique_ptr<_Ty[]> _Unknown_bound;
23
+ };
24
+
25
+ template <class _Ty , size_t N> struct _Unique_if <_Ty[N]> {
26
+ typedef void _Known_bound;
27
+ };
28
+
29
+ template <class _Ty , class ... Args>
30
+ typename _Unique_if<_Ty>::_Single_object
31
+ make_unique (Args&&... args) {
32
+ return unique_ptr<_Ty>(new _Ty (std::forward<Args>(args)...));
33
+ }
34
+
35
+ template <class _Ty >
36
+ typename _Unique_if<_Ty>::_Unknown_bound
37
+ make_unique (size_t n) {
38
+ typedef typename remove_extent<_Ty>::type U;
39
+ return unique_ptr<_Ty>(new U[n]());
40
+ }
41
+
42
+
43
+ } // namespace std
44
+
45
+ #endif // !COMPILER_SUPPORTS_MAKE_UNIQUE
46
+
You can’t perform that action at this time.
0 commit comments