- Home
- About DUNE
- Download
- Documentation
- Community
- Development
00001 #ifndef DUNE_FINITE_STACK_HH 00002 #define DUNE_FINITE_STACK_HH 00003 00004 #include <stack> 00005 00006 #include <dune/common/exceptions.hh> 00007 #include <dune/common/reservedvector.hh> 00008 00009 namespace Dune { 00010 00030 template<class T, int n> 00031 class FiniteStack 00032 : public std::stack<T, Dune::ReservedVector<T,n> > 00033 { 00034 public : 00035 00037 bool full () const 00038 { 00039 return this->size()>=n; 00040 } 00041 00045 T pop () 00046 { 00047 #ifndef NDEBUG 00048 if (this->empty()) 00049 DUNE_THROW(Dune::RangeError, "trying to call pop() on an empty FiniteStack"); 00050 #endif 00051 T tmp = this->top(); 00052 this->std::stack<T,Dune::ReservedVector<T,n> >::pop(); 00053 return tmp; 00054 } 00055 00056 }; 00057 00058 } 00059 00061 00062 #endif
Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].