unlogic
Loading...
Searching...
No Matches
overload.h
Go to the documentation of this file.
1
//
2
// Created by Nathan on 11/25/2024.
3
//
4
5
#ifndef OVERLOAD_H
6
#define OVERLOAD_H
7
8
namespace
unlogic
9
{
10
/*
11
* Helper for std::visit provided by Andreas Fertig.
12
* Apple-Clang 15 isn't C++23 compliant enough for the prettier solution, so C++17 style it is.
13
* https://andreasfertig.blog/2023/07/visiting-a-stdvariant-safely/
14
*/
15
template
<
class
...>
16
constexpr
bool
always_false_v
=
false
;
17
18
template
<
class
... Ts>
19
struct
overload
: Ts...
20
{
21
using
Ts::operator()...;
22
23
template
<
typename
T>
24
constexpr
void
operator()
(
T
)
const
25
{
26
static_assert
(
always_false_v<T>
,
"Unsupported type"
);
27
}
28
};
29
30
template
<
class
... Ts>
31
overload
(Ts...) ->
overload
<Ts...>;
32
}
// namespace unlogic
33
34
#endif
// OVERLOAD_H
unlogic
Definition
Compiler.h:18
unlogic::always_false_v
constexpr bool always_false_v
Definition
overload.h:16
unlogic::unique_node
UniqueNode unique_node(Args &&... args)
Definition
Node.h:144
unlogic::overload
Definition
overload.h:20
unlogic::overload::operator()
constexpr void operator()(T) const
Definition
overload.h:24
unlogic
src
util
overload.h
Generated by
1.9.8