IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
core
public
ice
concept
strong_type_value.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/concept/strong_type_base.hxx
>
6
7
namespace
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;
17
&&
ice::detail::OnlyMemberValue<T>
;
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>
31
struct
TaggedStrongValue
{ };
32
36
template
<
typename
T>
37
concept
TaggedStrongValueType
= std::is_pod_v<T>
38
&&
ice::detail::HasAliasTypeTag<T, ice::TaggedStrongValue<typename ice::detail::ExtractTemplateType<typename T::TypeTag>::Type
>>;
39
41
template
<
typename
T,
typename
U>
42
concept
SameTaggedTypes
= std::is_same_v<typename T::TypeTag, typename U::TypeTag>
43
&&
TaggedStrongValueType<T>
44
&&
TaggedStrongValueType<U>
;
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
ice::SameTaggedTypes
Concept used to ensure two strong types have the same tag type.
Definition
strong_type_value.hxx:42
ice::StrongValueType
Concept used to determine if a struct is considerd a strong type wrapper.
Definition
strong_type_value.hxx:15
ice::TaggedStrongValueType
Concept used to determine if a struct is considerd a tagged strong type wrapper.
Definition
strong_type_value.hxx:37
ice::detail::HasAliasTypeTag
Definition
strong_type_base.hxx:23
ice::detail::OnlyMemberValue
Definition
strong_type_base.hxx:20
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::operator==
constexpr auto operator==(ice::TimeType auto left, TimeType auto right) noexcept
Definition
clock_types.hxx:159
strong_type_base.hxx
ice::StrongValue
Type tag to enable utility functions for strongly typed values.
Definition
strong_type_value.hxx:11
ice::TaggedStrongValue
Type tag to enable utility functions for strongly typed values across multiple types.
Definition
strong_type_value.hxx:31
Generated by
1.18.0