AnySet Documentation
Public Types | Public Member Functions | Friends | List of all members
te::detail::AnyValueLink< Value, HashFn, Compare > Struct Template Reference

Detailed Description

template<class Value, class HashFn, class Compare>
struct te::detail::AnyValueLink< Value, HashFn, Compare >

This class is an implementation detail and is not part of the public interface of AnyValue.

AnyValueLink 'links' the AnyValue instance with its contained object by inheriting from ConstValueHolder<Value>. ConstValueHolder conditionally inherits from 'Value', depending on whether 'Value' is a non-final class type. The inheritence heirarchy looks like this:

       AnyValue            Value
          ^                  ^
           \                /     <<< This part of the inheritence tree is conditional
        TypedValue  ConstValueHolder
             ^            ^
              \          /
              AnyValueLink (final)

This allows us to implement polymorphic_cast() with a simple dynamic_cast. Since AnyValue introduces RTTI into the heirarchy, polymorphic_cast() can cast through Value's public inheritance heirarchy without knowing what the actual type of Value is, in spite of the fact that Value may not even be a polymorphic type itself.

#include <AnyNode.h>

Public Types

using self_type = AnyValueLink< Value, HashFn, Compare >
 
using holder_type = ConstValueHolder< Value >
 
using base_type = TypedValue< Value, HashFn, Compare >
 
- Public Types inherited from te::detail::TypedValue< Value, HashFn, Compare >
using base_type = AnyValue< HashFn, Compare >
 
using value_type = Value
 
using holder_type = ConstValueHolder< value_type >
 
using self_type = TypedValue< Value, HashFn, Compare >
 
using link_type = AnyValueLink< Value, HashFn, Compare >
 
- Public Types inherited from te::AnyValue< HashFn, Compare >
using self_type = AnyValue< HashFn, Compare >
 
using hasher = HashFn
 
using key_equal = Compare
 

Public Member Functions

template<class ... Args>
 AnyValueLink (std::size_t hash_v, Args &&... args)
 
template<class ... Args>
 AnyValueLink (HashFn hasher, Args &&... args)
 
- Public Member Functions inherited from te::detail::TypedValue< Value, HashFn, Compare >
 TypedValue (const self_type &)=delete
 
 TypedValue (self_type &&)=delete
 
self_typeoperator= (const self_type &)=delete
 
self_typeoperator= (self_type &&)=delete
 
bool equals (const base_type &other) const final override
 
bool not_equals (const base_type &other) const final override
 
bool compare_to (const base_type &other, Compare comp) const final override
 
void write (std::ostream &os) const final override
 
std::unique_ptr< base_typeclone () const final override
 
const std::type_infotypeinfo () const final override
 Get a reference to a std::type_info object that indicates the type of the contained object. More...
 
const value_type & value () const &
 
const value_type && value () const &&
 
- Public Member Functions inherited from te::AnyValue< HashFn, Compare >
 AnyValue (const AnyValue &)=delete
 
 AnyValue (AnyValue &&)=delete
 

Friends

struct TypedValue< Value, HashFn, Compare >
 
const Value & get_value (const self_type &self)
 
const Value && get_value (const self_type &&self)
 

Additional Inherited Members

- Public Attributes inherited from te::AnyValue< HashFn, Compare >
const std::size_t hash
 The hash code obtained by invoking an instance of HashFn on the contained object. More...
 
- Protected Member Functions inherited from te::detail::TypedValue< Value, HashFn, Compare >
 TypedValue (std::size_t hash_v)
 
- Protected Member Functions inherited from te::AnyValue< HashFn, Compare >
 AnyValue (std::size_t hash_v)
 
Inheritance diagram for te::detail::AnyValueLink< Value, HashFn, Compare >:
Inheritance graph
[legend]
Collaboration diagram for te::detail::AnyValueLink< Value, HashFn, Compare >:
Collaboration graph
[legend]

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