Macros for checking if a class meets a concept. More...
#include <concepts>#include "core/error.h"#include "util/macro_util.h"#include "concepts/config.h"Go to the source code of this file.
Macros | |
| #define | BBM_CHECK_RAW_CONCEPT(CONCEPTNAME, CLASSNAME, ...) static_assert( CONCEPTNAME<CLASSNAME __VA_OPT__(,) __VA_ARGS__>, BBM_ERROR_MSG(#CLASSNAME does not meet #CONCEPTNAME) ); |
| Check a class for a concept. | |
| #define | BBM_CHECK_CONCEPT(CONCEPTNAME, CLASSNAME, ...) |
| Check a class for a concept with bbm::concepts::archetypes in the namespace. | |
Macros for checking if a class meets a concept.
Examples:
The first checks if std::complex<float> is constructible from 2 floats, i.e., std::constructible_from< vec2d<float>, float, float> is true. This check can be used in evaluated and unevaluated contexts.
The second checks if bsdf_ptr<config> is constribile from a Value_t<config> where config is a archetypical bbm configuration. BBM_CHECK_CONCEPT ensure that bbm::concepts::archetype is in the namespace. This check can only be used in an unevaluated context.
| #define BBM_CHECK_CONCEPT | ( | CONCEPTNAME, | |
| CLASSNAME, | |||
| ... | |||
| ) |
Check a class for a concept with bbm::concepts::archetypes in the namespace.
| #define BBM_CHECK_RAW_CONCEPT | ( | CONCEPTNAME, | |
| CLASSNAME, | |||
| ... | |||
| ) | static_assert( CONCEPTNAME<CLASSNAME __VA_OPT__(,) __VA_ARGS__>, BBM_ERROR_MSG(#CLASSNAME does not meet #CONCEPTNAME) ); |
Check a class for a concept.