faunus
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
Faunus::BasePointerVector< T > Struct Template Reference

Helper class for storing vectors of base pointers. More...

#include <auxiliary.h>

Public Types

using value_type = std::shared_ptr< T >
 

Public Member Functions

auto begin () noexcept
 
auto begin () const noexcept
 
auto end () noexcept
 
auto end () const noexcept
 
auto empty () const noexcept
 
auto size () const noexcept
 
auto & back () noexcept
 
auto & back () const noexcept
 
auto & front () noexcept
 
auto & front () const noexcept
 
auto & at (size_t n)
 
auto & at (size_t n) const
 
template<typename Tderived , class... Args, class = std::enable_if_t<std::is_base_of<T, Tderived>::value>>
void emplace_back (Args &... args)
 Create an (derived) instance and append a pointer to it to the vector.
 
template<typename Tderived , class... Args, class = std::enable_if_t<std::is_base_of<T, Tderived>::value>>
void emplace_back (const Args &... args)
 Create an (derived) instance and append a pointer to it to the vector.
 
auto & push_back (value_type arg)
 Append a pointer to a (derived) instance to the vector.
 
template<typename Tderived , class = std::enable_if_t<std::is_base_of<T, Tderived>::value>>
auto & operator= (const BasePointerVector< Tderived > &d)
 Allow assignment to a vector of ancestors.
 
template<typename Tderived , class = std::enable_if_t<std::is_base_of<T, Tderived>::value>>
auto find () const
 Pointer list to all matching type.
 
template<typename Tderived , class = std::enable_if_t<std::is_base_of<T, Tderived>::value>>
std::shared_ptr< Tderived > findFirstOf () const
 

Public Attributes

std::vector< value_type > vec
 Vector of shared pointers to base class.
 

Friends

template<typename U >
void to_json (nlohmann::json &, const BasePointerVector< U > &)
 Allow serialization to JSON.
 

Detailed Description

template<typename T>
struct Faunus::BasePointerVector< T >

Helper class for storing vectors of base pointers.


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