DGtal  1.4.beta
DGtal::concepts::CStack< T > Struct Template Reference

Aim: This concept gathers classes that provide a stack interface. More...

#include <DGtal/base/CStack.h>

Inheritance diagram for DGtal::concepts::CStack< T >:
[legend]

Public Types

typedef T::value_type Value
 
typedef T::size_type Size
 

Public Member Functions

 BOOST_CONCEPT_USAGE (CStack)
 
void checkConstConstraints () const
 

Private Attributes

myX
 
Value myV
 
Size myS
 
bool myB
 

Detailed Description

template<typename T>
struct DGtal::concepts::CStack< T >

Aim: This concept gathers classes that provide a stack interface.

Description of concept 'CStack'

Refinement of copy constructible and assignable

Inner types

  • Value type of element stored in the stack
  • Size type that represents the number of elements

Notation

  • X : A type that is a model of CStack
  • x : object of type X
  • v : object of type Value

Definitions

Valid expressions and semantics

| Name | Expression | Type requirements | Return type | Precondition | Semantics | Post condition | Complexity | |----—+---------—+----------------—+---------------------—+-----------—+---------------------------------—+-------------—+---------—| | size | x.size() | | Size | | returns the number of elements | | O(1) | | empty | x.empty() | | bool | | 'true' is empty, 'false' otherwise | | O(1) | | top | x.top() | | Value& or const Value& | | returns the top element | | O(1) | | push | x.push(v) | | void | | inserts a new element at the top | | O(1) | | pop | x.pop() | | void | | removes the top element | | O(1) |

Models

std::stack, BackInsertionSequenceToStackAdapter, FrontInsertionSequenceToStackAdapter are the usual models of CStack.

Template Parameters
Tthe type that should be a model of CStack.

Definition at line 91 of file CStack.h.

Member Typedef Documentation

◆ Size

template<typename T >
typedef T::size_type DGtal::concepts::CStack< T >::Size

Definition at line 96 of file CStack.h.

◆ Value

template<typename T >
typedef T::value_type DGtal::concepts::CStack< T >::Value

Definition at line 95 of file CStack.h.

Member Function Documentation

◆ BOOST_CONCEPT_USAGE()

template<typename T >
DGtal::concepts::CStack< T >::BOOST_CONCEPT_USAGE ( CStack< T >  )
inline

Definition at line 98 of file CStack.h.

99  {
101  myX.push( myV );
102  myX.pop();
103 
104  // check const methods.
106  }
void sameType(const T &, const T &)
Definition: ConceptUtils.h:117
void checkConstConstraints() const
Definition: CStack.h:107

References DGtal::concepts::CStack< T >::checkConstConstraints(), DGtal::concepts::CStack< T >::myV, DGtal::concepts::CStack< T >::myX, and DGtal::concepts::ConceptUtils::sameType().

◆ checkConstConstraints()

Field Documentation

◆ myB

template<typename T >
bool DGtal::concepts::CStack< T >::myB
private

Definition at line 118 of file CStack.h.

Referenced by DGtal::concepts::CStack< T >::checkConstConstraints().

◆ myS

template<typename T >
Size DGtal::concepts::CStack< T >::myS
private

Definition at line 117 of file CStack.h.

Referenced by DGtal::concepts::CStack< T >::checkConstConstraints().

◆ myV

◆ myX

template<typename T >
T DGtal::concepts::CStack< T >::myX
private

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