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
8namespace nngn {
9
10template<typename T>
11concept trivial = std::is_trivial_v<T>;
12
13template<typename T>
14concept standard_layout = std::is_standard_layout_v<T>;
15
16template<typename D, typename B>
17concept 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
26template<typename From, typename To>
28 std::convertible_to<From, To>
29 && requires(From f) { { To{f} } -> std::same_as<To>; };
30
31}
32
33#endif
As std::convertible_to, but excluding implicit conversions.
Definition concepts.h:27
Definition concepts.h:17
Definition concepts.h:14
Definition concepts.h:11
Definition audio.cpp:7
local function f()) end