g2o
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SlamParser::Parser::stack< T, S > Class Template Reference

A stack with random access from its top. More...

Classes

class  slice
 Present a slice of the top of a stack. More...
 

Public Types

typedef S::iterator iterator
 
typedef S::const_iterator const_iterator
 
typedef S::size_type size_type
 
typedef std::ptrdiff_t index_type
 

Public Member Functions

 stack (size_type n=200) YY_NOEXCEPT
 
const T & operator[] (index_type i) const
 
T & operator[] (index_type i)
 
void push (YY_MOVE_REF(T) t)
 
void pop (std::ptrdiff_t n=1) YY_NOEXCEPT
 Pop elements from the stack.
 
void clear () YY_NOEXCEPT
 Pop all elements from the stack.
 
index_type size () const YY_NOEXCEPT
 Number of elements on the stack.
 
const_iterator begin () const YY_NOEXCEPT
 Iterator on top of the stack (going downwards).
 
const_iterator end () const YY_NOEXCEPT
 Bottom of the stack.
 

Private Member Functions

 stack (const stack &)
 Non copyable.
 
stackoperator= (const stack &)
 Non copyable.
 

Private Attributes

seq_
 The wrapped container.
 

Detailed Description

template<typename T, typename S = std::vector<T>>
class SlamParser::Parser::stack< T, S >

A stack with random access from its top.

Definition at line 630 of file bison_parser.h.

Member Typedef Documentation

◆ const_iterator

template<typename T , typename S = std::vector<T>>
typedef S::const_iterator SlamParser::Parser::stack< T, S >::const_iterator

Definition at line 634 of file bison_parser.h.

◆ index_type

template<typename T , typename S = std::vector<T>>
typedef std::ptrdiff_t SlamParser::Parser::stack< T, S >::index_type

Definition at line 636 of file bison_parser.h.

◆ iterator

template<typename T , typename S = std::vector<T>>
typedef S::iterator SlamParser::Parser::stack< T, S >::iterator

Definition at line 633 of file bison_parser.h.

◆ size_type

template<typename T , typename S = std::vector<T>>
typedef S::size_type SlamParser::Parser::stack< T, S >::size_type

Definition at line 635 of file bison_parser.h.

Constructor & Destructor Documentation

◆ stack() [1/2]

template<typename T , typename S = std::vector<T>>
SlamParser::Parser::stack< T, S >::stack ( size_type  n = 200)
inline

Definition at line 638 of file bison_parser.h.

638: seq_(n) {}
S seq_
The wrapped container.

◆ stack() [2/2]

template<typename T , typename S = std::vector<T>>
SlamParser::Parser::stack< T, S >::stack ( const stack< T, S > &  )
private

Non copyable.

Member Function Documentation

◆ begin()

template<typename T , typename S = std::vector<T>>
const_iterator SlamParser::Parser::stack< T, S >::begin ( ) const
inline

Iterator on top of the stack (going downwards).

Definition at line 679 of file bison_parser.h.

679{ return seq_.begin(); }

◆ clear()

template<typename T , typename S = std::vector<T>>
void SlamParser::Parser::stack< T, S >::clear ( )
inline

Pop all elements from the stack.

Definition at line 673 of file bison_parser.h.

673{ seq_.clear(); }

Referenced by SlamParser::Parser::parse().

◆ end()

template<typename T , typename S = std::vector<T>>
const_iterator SlamParser::Parser::stack< T, S >::end ( ) const
inline

Bottom of the stack.

Definition at line 682 of file bison_parser.h.

682{ return seq_.end(); }

◆ operator=()

template<typename T , typename S = std::vector<T>>
stack & SlamParser::Parser::stack< T, S >::operator= ( const stack< T, S > &  )
private

Non copyable.

◆ operator[]() [1/2]

template<typename T , typename S = std::vector<T>>
T & SlamParser::Parser::stack< T, S >::operator[] ( index_type  i)
inline

Random access.

Index 0 returns the topmost element.

Definition at line 657 of file bison_parser.h.

657{ return seq_[size_type(size() - 1 - i)]; }
index_type size() const YY_NOEXCEPT
Number of elements on the stack.

◆ operator[]() [2/2]

template<typename T , typename S = std::vector<T>>
const T & SlamParser::Parser::stack< T, S >::operator[] ( index_type  i) const
inline

Random access.

Index 0 returns the topmost element.

Definition at line 650 of file bison_parser.h.

650 {
651 return seq_[size_type(size() - 1 - i)];
652 }

◆ pop()

template<typename T , typename S = std::vector<T>>
void SlamParser::Parser::stack< T, S >::pop ( std::ptrdiff_t  n = 1)
inline

Pop elements from the stack.

Definition at line 668 of file bison_parser.h.

668 {
669 for (; 0 < n; --n) seq_.pop_back();
670 }

Referenced by SlamParser::Parser::yypop_().

◆ push()

template<typename T , typename S = std::vector<T>>
void SlamParser::Parser::stack< T, S >::push ( YY_MOVE_REF(T)  t)
inline

Steal the contents of t.

Close to move-semantics.

Definition at line 662 of file bison_parser.h.

662 {
663 seq_.push_back(T());
664 operator[](0).move(t);
665 }
const T & operator[](index_type i) const

Referenced by SlamParser::Parser::yypush_().

◆ size()

template<typename T , typename S = std::vector<T>>
index_type SlamParser::Parser::stack< T, S >::size ( ) const
inline

Number of elements on the stack.

Definition at line 676 of file bison_parser.h.

676{ return index_type(seq_.size()); }

Referenced by SlamParser::Parser::parse().

Member Data Documentation

◆ seq_

template<typename T , typename S = std::vector<T>>
S SlamParser::Parser::stack< T, S >::seq_
private

The wrapped container.

Definition at line 705 of file bison_parser.h.


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