4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::recursive< Type > Class Template Reference

Detailed Description

template<typename Type>
class fcppt::recursive< Type >

Turns an incomplete type into a complete one, allowing recursion.

Unfortunately, C++ makes no guarantees that incomplete types can be used as a template parameter of a container like std::vector. For example, the following might or might not work:

struct X { std::vector<X> x; };

The recursive class uses a unique pointer internally which allows its type to be incomplete. We can therefore write

struct X { std::vector<fcppt::recursive<X>> x; };

Public Member Functions

 recursive (Type const &)
 
 recursive (Type &&)
 
 recursive (recursive const &)
 
 recursive (recursive &&) noexcept
 
recursiveoperator= (recursive const &)
 
recursiveoperator= (recursive &&) noexcept
 
 ~recursive ()
 
Type & get ()
 
Type const & get () const
 
Type * operator-> ()
 
Type const * operator-> () const
 

Constructor & Destructor Documentation

◆ recursive() [1/4]

template<typename Type >
fcppt::recursive< Type >::recursive ( Type const & )
explicit

◆ recursive() [2/4]

template<typename Type >
fcppt::recursive< Type >::recursive ( Type && )
explicit

◆ recursive() [3/4]

template<typename Type >
fcppt::recursive< Type >::recursive ( recursive< Type > const & )

◆ recursive() [4/4]

template<typename Type >
fcppt::recursive< Type >::recursive ( recursive< Type > && )
noexcept

◆ ~recursive()

template<typename Type >
fcppt::recursive< Type >::~recursive ( )

Member Function Documentation

◆ get() [1/2]

template<typename Type >
Type & fcppt::recursive< Type >::get ( )
nodiscard

◆ get() [2/2]

template<typename Type >
Type const & fcppt::recursive< Type >::get ( ) const
nodiscard

◆ operator->() [1/2]

template<typename Type >
Type * fcppt::recursive< Type >::operator-> ( )
nodiscard

◆ operator->() [2/2]

template<typename Type >
Type const * fcppt::recursive< Type >::operator-> ( ) const
nodiscard

◆ operator=() [1/2]

template<typename Type >
recursive & fcppt::recursive< Type >::operator= ( recursive< Type > && )
noexcept

◆ operator=() [2/2]

template<typename Type >
recursive & fcppt::recursive< Type >::operator= ( recursive< Type > const & )