PrevUpHomeNext

kpp::dynamic_castable_from


---- kpp::dynamic_castable_from << Basic Concepts << Type System << Kpp c++ ----

kpp::dynamic_castable_from is a c++ concept of kpp c++ library that requires a type can be dynamic_cast from another type.

template <typename to_type, typename from_type>
concept dynamic_castable_from = ...;

c++ example

#include <kpp/types.hpp>

class: z {};

class a: public z {};
{
public:
	virtual void fn() {}
	virtual ~a() {}
};

class b: public a {};

static_assert(kpp::dynamic_castable_from<a &, b &>);
static_assert(kpp::dynamic_castable_from<b &, a &>);

static_assert(kpp::dynamic_castable_from<z &, a &>);
static_assert(! kpp::dynamic_castable_from<a &, z &>);

static_assert(kpp::dynamic_castable_from<z &, b &>);
static_assert(! kpp::dynamic_castable_from<b &, z &>);

int main()
{
}

See Also

kpp::dynamic_castable_to

kpp::kspt::ostream

Back

Up










Deck

Kpp Home


PrevUpHomeNext