IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
strong_type_value.hxx
Go to the documentation of this file.
1
3
4#pragma once
6
7namespace ice
8{
9
11 struct StrongValue { };
12
14 template<typename T>
15 concept StrongValueType = std::is_pod_v<T>
16 && ice::detail::HasAliasTypeTag<T, ice::StrongValue> // using TypeTag = ice::StrongValue;
18
19 template<typename T> requires ice::StrongValueType<T>
20 constexpr bool operator==(T left, T right) noexcept
21 {
22 return left.value == right.value;
23 }
24
25
30 template<typename Tag>
32
36 template<typename T>
37 concept TaggedStrongValueType = std::is_pod_v<T>
39
41 template<typename T, typename U>
42 concept SameTaggedTypes = std::is_same_v<typename T::TypeTag, typename U::TypeTag>
45
46 template<typename T, typename U> requires ice::SameTaggedTypes<T, U>
47 constexpr bool operator==(T left, U right) noexcept
48 {
49 return left.value == right.value;
50 }
51
52} // namespace ice
Concept used to ensure two strong types have the same tag type.
Definition strong_type_value.hxx:42
Concept used to determine if a struct is considerd a strong type wrapper.
Definition strong_type_value.hxx:15
Concept used to determine if a struct is considerd a tagged strong type wrapper.
Definition strong_type_value.hxx:37
Definition strong_type_base.hxx:23
Definition strong_type_base.hxx:20
SPDX-License-Identifier: MIT.
Definition array.hxx:12
constexpr auto operator==(ice::TimeType auto left, TimeType auto right) noexcept
Definition clock_types.hxx:159
Type tag to enable utility functions for strongly typed values.
Definition strong_type_value.hxx:11
Type tag to enable utility functions for strongly typed values across multiple types.
Definition strong_type_value.hxx:31