boost::openmethod::policies::RttiFn::is_polymorphic

Tests if the policy can find the class of an object at run time.

Synopsis

Declared in <boost/openmethod/preamble.hpp>

template<class Class>
static
bool const is_polymorphic;

Description

true if Class is polymorphic in the sense of the policy: given a reference to a Class, dynamic_type finds the class of the object it refers to. This need not match the C++ notion of a polymorphic class. When it is true:

  • virtual_<Class&> is a valid parameter type. A class that carries its own v‐table pointer, see inplace_vptr_base, is valid either way.

  • A virtual_ptr can be constructed from a reference, a pointer or a smart pointer to a Class. Otherwise, final_virtual_ptr is the only way to make one.

  • With runtime checks, final_virtual_ptr verifies that the class of the object is exactly Class.

The value is up to the policy, and must be a constant expression. std_rtti uses std::is_polymorphic_v<Class>; static_rtti deems no class polymorphic.

When this is true, the policy owes a dynamic_type for Class. A policy that deems no class polymorphic may omit dynamic_type altogether.

Template Parameters

Name

Description

Class

A class.

Created with MrDocs