nngn
Loading...
Searching...
No Matches
concepts.h
Go to the documentation of this file.
1
#ifndef NNGN_UTILS_CONCEPTS_H
2
#define NNGN_UTILS_CONCEPTS_H
3
4
#include <concepts>
5
#include <type_traits>
6
#include <version>
7
8
namespace
nngn
{
9
10
template
<
typename
T>
11
concept
trivial
= std::is_trivial_v<T>;
12
13
template
<
typename
T>
14
concept
standard_layout
= std::is_standard_layout_v<T>;
15
16
template
<
typename
D,
typename
B>
17
concept
derived_from
=
18
#ifdef _LIBCPP_VERSION
19
std::is_base_of_v<B, D>
20
&& std::is_convertible_v<const volatile D*, const volatile B*>;
21
#else
22
std::derived_from<D, B>;
23
#endif
24
26
template
<
typename
From,
typename
To>
27
concept
convertible_to_strict
=
28
std::convertible_to<From, To>
29
&&
requires
(From
f
) { { To{
f
} } -> std::same_as<To>; };
30
31
}
32
33
#endif
nngn::convertible_to_strict
As std::convertible_to, but excluding implicit conversions.
Definition
concepts.h:27
nngn::derived_from
Definition
concepts.h:17
nngn::standard_layout
Definition
concepts.h:14
nngn::trivial
Definition
concepts.h:11
nngn
Definition
audio.cpp:7
f
local function f()) end
src
utils
concepts.h
Generated by
1.11.0