ORIGINAL
Loading...
Searching...
No Matches
original::SuperOf Concept Reference

Checks inheritance or type equality. More...

#include <types.h>

Concept definition

template<typename Base, typename Derive>
concept original::SuperOf = std::is_base_of_v<Base, Derive> || std::is_same_v<Base, Derive>
Checks inheritance or type equality.
Definition types.h:137

Detailed Description

Checks inheritance or type equality.

Template Parameters
BaseBase class or type
DeriveDerived class or same type

Combines std::is_base_of_v and std::is_same_v to validate "is-a" relationships.

struct Base {};
struct Derived : Base {};
static_assert(SuperOf<Base, Derived>); // Passes: inheritance
static_assert(SuperOf<int, int>); // Passes: same type
static_assert(!SuperOf<Derived, Base>); // Fails: reverse inheritance