Spicy
Public Member Functions | List of all members
hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs > Class Template Reference

#include <type_erase.h>

Inheritance diagram for hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >:
hilti::util::type_erasure::trait::TypeErased

Public Member Functions

 ErasedBase (const ErasedBase &other)=default
 
 ErasedBase (ErasedBase &&other) noexcept=default
 
ErasedBaseoperator= (const ErasedBase &other)=default
 
ErasedBaseoperator= (ErasedBase &&other) noexcept=default
 
template<typename T , IF_DERIVED_FROM(T, Trait) >
 ErasedBase (T t, ConceptArgs &&... args)
 
ErasedBaseoperator= (IntrusivePtr< Concept > data)
 
const std::type_info & typeid_ () const
 
std::string typename_ () const
 
template<typename T >
const T & as () const
 
template<typename T >
T & as ()
 
template<typename T >
bool isA () const
 
template<typename T >
optional_ref< const T > tryAs () const
 
auto & data () const
 
auto & data ()
 
uintptr_t identity () const
 

Detailed Description

template<typename Trait, typename Concept, template< typename T > typename Model, typename... ConceptArgs>
class hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >

Base class for the publicly visible, type-erased interface class.

Member Function Documentation

◆ as() [1/2]

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
template<typename T >
const T& hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::as ( ) const
inline

Casts the contained object into a specified type. This will aborts execution if the cast is not possible.

◆ as() [2/2]

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
template<typename T >
T& hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::as ( )
inline

Casts the contained object into a specified type. This will aborts execution if the cast is not possible.

◆ data() [1/2]

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
auto& hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::data ( ) const
inline

For internal use.

◆ data() [2/2]

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
auto& hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::data ( )
inline

For internal use.

◆ identity()

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
uintptr_t hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::identity ( ) const
inline

For internal use.

◆ isA()

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
template<typename T >
bool hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::isA ( ) const
inline

Returns true if the contained object can be casted into a specified type.

◆ tryAs()

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
template<typename T >
optional_ref<const T> hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::tryAs ( ) const
inline

Attempts to cast the contained object into a specified type.

◆ typeid_()

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
const std::type_info& hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::typeid_ ( ) const
inline

Returns type information for the contained type. If multiple type-erased objects are nested, it will return the information for the inner-most type.

◆ typename_()

template<typename Trait , typename Concept , template< typename T > typename Model, typename... ConceptArgs>
std::string hilti::util::type_erasure::ErasedBase< Trait, Concept, Model, ConceptArgs >::typename_ ( ) const
inline

Returns C++ type name for the contained type. If multiple type-erased objects are nested, it will return the information for the inner-most type.


The documentation for this class was generated from the following file: