kblib 0.2.3
General utilities library for modern C++
delayed_construct.cpp
Go to the documentation of this file.
2#include "catch.hpp"
3
4#if KBLIB_USE_CXX17
5
6TEST_CASE("delayed_construct") {
8 REQUIRE(a == b);
9 REQUIRE(not (a != b));
10 REQUIRE(not (a < b));
11 REQUIRE(a <= b);
12 REQUIRE(not (a > b));
13 REQUIRE(a >= b);
14}
15
16class no_hash {};
17
18static_assert(
19 std::is_default_constructible_v<std::hash<kblib::delayed_construct<int>>>,
20 "hashing a delayed_construct<T> is possible if hashing T is possible");
21static_assert(not std::is_default_constructible_v<
22 std::hash<kblib::delayed_construct<no_hash>>>,
23 "hashing a delayed_construct<T> is not possible if hashing T is "
24 "not possible");
25
26#endif
TEST_CASE("delayed_construct")
Provides delayed_construct, an optional-like type that cannot be cleared.
constexpr auto a(const std::initializer_list< T > &a) -> auto
Index an array literal without naming its type.
Definition: simple.h:255