Skip to content

Commit

Permalink
Enable C++23
Browse files Browse the repository at this point in the history
Remove unmove, which doesn't compile with C++23 and was only used for
convenience in a test.
  • Loading branch information
frankosterfeld committed Apr 26, 2024
1 parent 283a2c8 commit 37e6fb4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.19)

project(opencmw-cpp CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)

# include(cmake/StandardProjectSettings.cmake)
include(cmake/PreventInSourceBuilds.cmake)
Expand Down
2 changes: 0 additions & 2 deletions src/core/include/opencmw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ constexpr bool always_false = false;
using units::basic_fixed_string;
using units::is_same_v;

constexpr auto &unmove(auto &&t) { return t; } // opposite of std::move(...)

template<typename R, typename Fn, typename... FnArgs>
concept invocable_r = std::is_invocable_r_v<R, Fn, FnArgs...>;

Expand Down
4 changes: 0 additions & 4 deletions src/core/test/00_opencmw_basic_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ static_assert(no_fwd_wrapper(0) == 1, "r-value non-forwarding -> converted to lv
static_assert(fwd_wrapper_verbose(0) == 2, "r-value forwarding");
static_assert(fwd_wrapper(0) == 2, "r-value forwarding");

/**** unmove(..) tests ***/
static_assert(fwd_wrapper(unmove(lvalue)) == 1, "l-value -> l-value forwarding (copy)");
static_assert(fwd_wrapper(unmove(0)) == 1, "r-value -> lvalue forwarding (copy)");

/**** power 2 and bit-magic tests ***/
static_assert(isPower2(1024U));
static_assert(is_power2_v<1024U>);
Expand Down
6 changes: 4 additions & 2 deletions src/serialiser/test/IoSerialiserYaS_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,10 @@ TEST_CASE("IoSerialiser basic syntax", "[IoSerialiser]") {
REQUIRE(opencmw::is_annotated<decltype(data.value)> == true);
std::cout << fmt::format("buffer size (before): {} bytes\n", buffer.size());

opencmw::FieldHeaderWriter<opencmw::YaS>::template put<true>(buffer, unmove(FieldDescriptionShort{ .fieldName = "fieldNameA" }), 43.0);
opencmw::FieldHeaderWriter<opencmw::YaS>::template put<true>(buffer, unmove(FieldDescriptionShort{ .fieldName = "fieldNameB" }), data.value.value());
auto fieldA = FieldDescriptionShort{ .fieldName = "fieldNameA" };
opencmw::FieldHeaderWriter<opencmw::YaS>::template put<true>(buffer, fieldA, 43.0);
auto fieldB = FieldDescriptionShort{ .fieldName = "fieldNameB" };
opencmw::FieldHeaderWriter<opencmw::YaS>::template put<true>(buffer, fieldB, data.value.value());
std::cout << fmt::format("buffer size (after): {} bytes\n", buffer.size());
}
REQUIRE(opencmw::debug::dealloc == opencmw::debug::alloc); // a memory leak occurred
Expand Down

0 comments on commit 37e6fb4

Please sign in to comment.