Bond 0.9
C++ Bond Runtime Library API Documentation
Loading...
Searching...
No Matches
Bond::AutoStack< ValueType >::Element Class Reference

A single value on an AutoStack, owned by the scope that pushed it. More...

#include <bond/stl/autostack.h>

Public Member Functions

 Element (AutoStack &stack)
 Constructs an Element holding a default constructed value and pushes it onto the given stack.
template<typename... Args>
 Element (AutoStack &stack, Args &&... args)
 Constructs an Element holding a value constructed from the given arguments and pushes it onto the given stack.
 ~Element ()
 Pops the Element from its stack. The Element must be at the top of the stack.
 Element (const Element &other)=delete
Element & operator= (const Element &other)=delete
Element & operator= (const ValueType &value)
 Assigns a copy of the given value to the Element.
Element & operator= (ValueType &&value)
 Moves the given value into the Element.
 operator const ValueType & () const noexcept
 Implicitly converts the Element to a const reference to its value.
 operator ValueType & () noexcept
 Implicitly converts the Element to a reference to its value.
const ValueType & GetValue () const noexcept
 Returns a const reference to the value held by the Element.
ValueType & GetValue () noexcept
 Returns a reference to the value held by the Element.
void SetValue (const ValueType &value)
 Assigns a copy of the given value to the Element.
void SetValue (ValueType &&value)
 Moves the given value into the Element.

Protected Member Functions

Element * GetNext () noexcept
const Element * GetNext () const noexcept

Protected Attributes

ValueType mValue

Friends

class AutoStack
class Iterator
class ConstIterator

Detailed Description

template<typename ValueType>
class Bond::AutoStack< ValueType >::Element

A single value on an AutoStack, owned by the scope that pushed it.

An Element is pushed onto its stack when it is constructed and popped when it is destroyed. An Element cannot be copied or moved.

Constructor & Destructor Documentation

◆ Element() [1/3]

template<typename ValueType>
Bond::AutoStack< ValueType >::Element::Element ( AutoStack & stack)
inlineexplicit

Constructs an Element holding a default constructed value and pushes it onto the given stack.

Parameters
stackThe stack onto which the Element is pushed. It must outlive the Element.

◆ Element() [2/3]

template<typename ValueType>
template<typename... Args>
Bond::AutoStack< ValueType >::Element::Element ( AutoStack & stack,
Args &&... args )
inline

Constructs an Element holding a value constructed from the given arguments and pushes it onto the given stack.

Parameters
stackThe stack onto which the Element is pushed. It must outlive the Element.
argsThe arguments forwarded to the constructor of the value.

◆ ~Element()

template<typename ValueType>
Bond::AutoStack< ValueType >::Element::~Element ( )
inline

Pops the Element from its stack. The Element must be at the top of the stack.

◆ Element() [3/3]

template<typename ValueType>
Bond::AutoStack< ValueType >::Element::Element ( const Element & other)
delete

Member Function Documentation

◆ GetNext() [1/2]

template<typename ValueType>
const Element * Bond::AutoStack< ValueType >::Element::GetNext ( ) const
inlineprotectednoexcept

◆ GetNext() [2/2]

template<typename ValueType>
Element * Bond::AutoStack< ValueType >::Element::GetNext ( )
inlineprotectednoexcept

◆ GetValue() [1/2]

template<typename ValueType>
const ValueType & Bond::AutoStack< ValueType >::Element::GetValue ( ) const
inlinenoexcept

Returns a const reference to the value held by the Element.

◆ GetValue() [2/2]

template<typename ValueType>
ValueType & Bond::AutoStack< ValueType >::Element::GetValue ( )
inlinenoexcept

Returns a reference to the value held by the Element.

◆ operator const ValueType &()

template<typename ValueType>
Bond::AutoStack< ValueType >::Element::operator const ValueType & ( ) const
inlinenoexcept

Implicitly converts the Element to a const reference to its value.

◆ operator ValueType &()

template<typename ValueType>
Bond::AutoStack< ValueType >::Element::operator ValueType & ( )
inlinenoexcept

Implicitly converts the Element to a reference to its value.

◆ operator=() [1/3]

template<typename ValueType>
Element & Bond::AutoStack< ValueType >::Element::operator= ( const Element & other)
delete

◆ operator=() [2/3]

template<typename ValueType>
Element & Bond::AutoStack< ValueType >::Element::operator= ( const ValueType & value)
inline

Assigns a copy of the given value to the Element.

Parameters
valueThe value to be copied.
Returns
A reference to this Element.

◆ operator=() [3/3]

template<typename ValueType>
Element & Bond::AutoStack< ValueType >::Element::operator= ( ValueType && value)
inline

Moves the given value into the Element.

Parameters
valueThe value to be moved.
Returns
A reference to this Element.

◆ SetValue() [1/2]

template<typename ValueType>
void Bond::AutoStack< ValueType >::Element::SetValue ( const ValueType & value)
inline

Assigns a copy of the given value to the Element.

Parameters
valueThe value to be copied.

◆ SetValue() [2/2]

template<typename ValueType>
void Bond::AutoStack< ValueType >::Element::SetValue ( ValueType && value)
inline

Moves the given value into the Element.

Parameters
valueThe value to be moved.

◆ AutoStack

template<typename ValueType>
friend class AutoStack
friend

◆ ConstIterator

template<typename ValueType>
friend class ConstIterator
friend

◆ Iterator

template<typename ValueType>
friend class Iterator
friend

Member Data Documentation

◆ mValue

template<typename ValueType>
ValueType Bond::AutoStack< ValueType >::Element::mValue
protected

The documentation for this class was generated from the following file:
  • include/bond/stl/autostack.h