Skip to content

Commit b4f0105

Browse files
authored
Merge pull request #1174 from trws/cxx20
up the required C++ standard to 20
2 parents cb95173 + 78bc78a commit b4f0105

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if(POLICY CMP0140)
1919
cmake_policy(SET CMP0140 NEW)
2020
endif()
2121

22-
set(CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard to use")
22+
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
2323
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2424
set(CMAKE_CXX_EXTENSIONS OFF)
2525

resource/planner/c++/planner_multi.hpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ struct planner_multi_meta {
3535
struct idx {};
3636
struct res_type {};
3737

38+
template<typename T>
39+
struct polyfill_allocator : std::allocator<T> {
40+
using std::allocator<T>::allocator;
41+
template<typename U>
42+
struct rebind {
43+
using other = polyfill_allocator<U>;
44+
};
45+
using pointer = T*;
46+
using const_pointer = T const*;
47+
using reference = T&;
48+
using const_reference = T const&;
49+
};
50+
3851
using boost::multi_index_container;
3952
using namespace boost::multi_index;
4053
typedef multi_index_container<
@@ -47,7 +60,8 @@ typedef multi_index_container<
4760
tag<res_type>, // index nametag
4861
member<planner_multi_meta, std::string, &planner_multi_meta::resource_type> // index's key
4962
>
50-
>
63+
>,
64+
polyfill_allocator<planner_multi_meta>
5165
> multi_container;
5266

5367
class planner_multi {

0 commit comments

Comments
 (0)