PrevUpHomeNext

kpp::dynamic_castable_to


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

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

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

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_to<b &, a &>);
static_assert(kpp::dynamic_castable_to<a &, b &>);

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

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

int main()
{
}

See Also

kpp::dynamic_castable_from

kpp::kspt::ostream

Back

Up










Deck

Kpp Home


PrevUpHomeNext