Concept to check if a type is representing a polymorphic storage

Synopsis

Declared in <mrdocs/Support/Concepts.hpp>

template<
    class T,
    class Base>
concept polymorphic_storage_for = requires(T const& t)
{
    { *t } ‐> std::convertible_to<Base const&>;
    { t.operator‐>() } ‐> std::convertible_to<Base const*>;
};

Description

This concept checks if a type is used to store derived objects of a base class.

Examples of such types are std::unique_ptr, std::shared_ptr, Polymorphic, etc.

The get() function might not always be available, but operator and `operator‐> should be available and return a reference to the Base class.

Created with MrDocs