Skip to content

Commit 0e8e913

Browse files
authored
Merge pull request #1104 from PowerGridModel/feature/enable-cpp23
Compiler support: enable C++23 in PGM core compilation
2 parents 9d003f5 + f77ebda commit 0e8e913

File tree

5 files changed

+8
-20
lines changed

5 files changed

+8
-20
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ project (power_grid_model VERSION ${PGM_VERSION})
1313

1414
option(PGM_ENABLE_DEV_BUILD "Enable developer build (e.g.: tests)" OFF)
1515

16-
set(CMAKE_CXX_STANDARD 20)
16+
set(CMAKE_CXX_STANDARD 23)
1717
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1818
set(CMAKE_CXX_EXTENSIONS OFF)
1919
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

docs/advanced_documentation/build-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ In this way, minimum effort should be necessary to port the library to other pla
4040

4141
### Compiler Support
4242

43-
You need a C++ compiler with C++20 support.
43+
You need a C++ compiler with C++23 support.
4444
Below is a list of tested compilers:
4545

4646
#### Linux

power_grid_model_c/power_grid_model/include/power_grid_model/common/grouped_index_vector.hpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
#include "iterator_facade.hpp"
1010
#include "typing.hpp"
1111

12-
#include <boost/iterator/zip_iterator.hpp>
13-
#include <boost/range.hpp>
14-
#include <boost/range/adaptor/indexed.hpp>
15-
#include <boost/range/counting_range.hpp>
16-
12+
#include <algorithm>
1713
#include <ranges>
1814

1915
/*
@@ -272,13 +268,8 @@ inline auto enumerated_zip_sequence(grouped_idx_vector_type auto const& first,
272268
grouped_idx_vector_type auto const&... rest) {
273269
assert(((first.size() == rest.size()) && ...));
274270

275-
auto const indices = boost::counting_range(Idx{}, first.size());
276-
277-
auto const zip_begin =
278-
boost::make_zip_iterator(boost::make_tuple(std::cbegin(indices), std::cbegin(first), std::cbegin(rest)...));
279-
auto const zip_end =
280-
boost::make_zip_iterator(boost::make_tuple(std::cend(indices), std::cend(first), std::cend(rest)...));
281-
return boost::make_iterator_range(zip_begin, zip_end);
271+
auto const indices = IdxRange{first.size()};
272+
return std::views::zip(indices, first, rest...);
282273
}
283274

284275
} // namespace power_grid_model

power_grid_model_c/power_grid_model/include/power_grid_model/container.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#include "common/iterator_facade.hpp"
1212
#include "container_fwd.hpp"
1313

14-
#include <boost/range.hpp>
15-
14+
#include <algorithm>
1615
#include <array>
16+
#include <cassert>
1717
#include <functional>
1818
#include <memory>
1919
#include <numeric>
@@ -188,7 +188,7 @@ class Container<RetrievableTypes<GettableTypes...>, StorageableTypes...> {
188188
assert(construction_complete_);
189189
assert(seq >= 0);
190190
std::array<Idx, num_storageable + 1> const& cum_size = cum_size_[get_cls_pos_v<Gettable, GettableTypes...>];
191-
auto const found = std::upper_bound(cum_size.begin(), cum_size.end(), seq);
191+
auto const found = std::ranges::upper_bound(cum_size, seq);
192192
assert(found != cum_size.end());
193193
auto const group = static_cast<Idx>(std::distance(cum_size.cbegin(), found) - 1);
194194
return Idx2D{.group = group, .pos = seq - cum_size[group]};

tests/cpp_unit_tests/test_y_bus.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
#include <doctest/doctest.h>
99

10-
#include <boost/range/adaptors.hpp>
11-
#include <boost/range/irange.hpp>
12-
1310
#include <ranges>
1411

1512
namespace power_grid_model {

0 commit comments

Comments
 (0)