23template <
typename T,
typename Tag>
27 !std::is_reference_v<T>,
28 "The underlying type must not be a reference. This struct is not "
29 "designed for references. If its design should be extended to also "
30 "cover references make sure to unit test it throroughly. In this case "
31 "also consider the implications for the overall usage of StrongType in "
32 "the code, e.g., StrongType<int, struct Tag> and StrongType<int&, "
33 "struct Tag> are not related to each other by any inheritance "
34 "relation, but are completely different types, and in particular "
35 "cannot be passed to functions expecting a value/reference of the "
36 "other type. Therefore, allowing references as underlying types might "
37 "have adverse effect on \"large scale\" API design.");
40 std::default_initializable<T>,
41 "The underlying type must be default initializable. This struct is "
42 "designed for \"general purpose\" underlying types such as numbers or "
43 "matrices, which are usually default constructible. If you need "
44 "support for non-default-constuctible underlying types, make sure you "
45 "test your extension of the current implementation thoroughly.");
47 constexpr StrongType() noexcept(std::is_nothrow_default_constructible_v<T>)
53 std::is_nothrow_copy_constructible_v<T>)
59 std::is_nothrow_move_constructible_v<T>)
67 [[nodiscard]]
constexpr T
const&
operator()() const noexcept
75 [[nodiscard]]
constexpr T
const&
operator*() const noexcept
82 [[nodiscard]]
constexpr T
const*
operator->() const noexcept
constexpr T const * operator->() const noexcept
constexpr StrongType() noexcept(std::is_nothrow_default_constructible_v< T >)
constexpr T * operator->() noexcept
Value access.
constexpr StrongType(T &&value) noexcept(std::is_nothrow_move_constructible_v< T >)
constexpr StrongType(T const &value) noexcept(std::is_nothrow_copy_constructible_v< T >)
constexpr T & operator*() noexcept
constexpr T & operator()() noexcept
constexpr T const & operator*() const noexcept
constexpr T const & operator()() const noexcept