Skip to content

Commit b0fdeb0

Browse files
committed
Add reserve_space_for type to allow constructing a vector-like container with a specific capacity.
1 parent f04f935 commit b0fdeb0

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ target_sources(containers PUBLIC
345345
source/containers/reference_wrapper.cpp
346346
source/containers/repeat_n.cpp
347347
source/containers/reservable.cpp
348+
source/containers/reserve_space_for.cpp
348349
source/containers/resizable_container.cpp
349350
source/containers/resize.cpp
350351
source/containers/sentinel_t.cpp

source/containers/containers.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export import containers.range_view;
9494
export import containers.reallocation_size;
9595
export import containers.reference_wrapper;
9696
export import containers.repeat_n;
97+
export import containers.reserve_space_for;
9798
export import containers.resizable_container;
9899
export import containers.resize;
99100
export import containers.small_buffer_optimized_vector;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright David Stone 2023.
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
export module containers.reserve_space_for;
7+
8+
namespace containers {
9+
10+
export template<typename Capacity>
11+
struct reserve_space_for {
12+
Capacity value;
13+
};
14+
15+
} // namespace containers

0 commit comments

Comments
 (0)