dune-common  2.2.1
finitestack.hh
Go to the documentation of this file.
1 #ifndef DUNE_FINITE_STACK_HH
2 #define DUNE_FINITE_STACK_HH
3 
8 #warning This file is deprecated and will be removed after the release of dune-common-2.2. \
9  Please use std::stack<Dune::ReservedVector> instead of FiniteStack.
10 
11 #include <stack>
12 
15 
16 namespace Dune {
17 
37  template<class T, int n>
38  class FiniteStack
39  : public std::stack<T, Dune::ReservedVector<T,n> >
40  {
41  public :
42 
44  bool full () const
45  {
46  return this->size()>=n;
47  }
48 
52  T pop ()
53  {
54 #ifndef NDEBUG
55  if (this->empty())
56  DUNE_THROW(Dune::RangeError, "trying to call pop() on an empty FiniteStack");
57 #endif
58  T tmp = this->top();
59  this->std::stack<T,Dune::ReservedVector<T,n> >::pop();
60  return tmp;
61  }
62 
63  };
64 
65 }
66 
68 
69 #endif