Hegel 0.11.4
Property-based testing for C++
Loading...
Searching...
No Matches
config.h
1#pragma once
2
3// Compile-time feature configuration. Not part of the documented API surface.
4
5// HEGEL_HAS_REFLECTION — whether the reflect-cpp powered features
6// (default_generator and automatic parsing of reflectable structs) are
7// available. The CMake build defines it: 1 with HEGEL_REFLECTION=ON (default,
8// requires C++20), 0 otherwise. When unset (headers used outside the CMake
9// target) it falls back to whether the compiler advertises C++20 concepts.
10// HEGEL_REFLECTION=OFF drops reflect-cpp so the library is consumable from
11// C++17; everything except default_generator still works.
12#ifndef HEGEL_HAS_REFLECTION
13#if defined(__cpp_concepts) && __cpp_concepts >= 201907L
14#define HEGEL_HAS_REFLECTION 1
15#else
16#define HEGEL_HAS_REFLECTION 0
17#endif
18#endif
19
20// HEGEL_REQUIRES — a requires-clause under C++20, nothing under C++17.
21// Constrained templates pair it with a static_assert so misuse is still
22// rejected with a clear message when concepts are unavailable.
23#if defined(__cpp_concepts) && __cpp_concepts >= 201907L
24#define HEGEL_REQUIRES(...) requires(__VA_ARGS__)
25#else
26#define HEGEL_REQUIRES(...)
27#endif
28
29namespace hegel::internal {
33 template <typename...> inline constexpr bool always_false_v = false;
35} // namespace hegel::internal