/usr/include/dune/common/finitestack.hh is in libdune-common-dev 2.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #ifndef DUNE_FINITE_STACK_HH
#define DUNE_FINITE_STACK_HH
/** \file
* \brief Stack class of fixed maximum size (deprecated)
*/
#warning This file is deprecated and will be removed after the release of dune-common-2.2. \
Please use std::stack<Dune::ReservedVector> instead of FiniteStack.
#include <stack>
#include <dune/common/exceptions.hh>
#include <dune/common/reservedvector.hh>
namespace Dune {
/*! \addtogroup Common
@{
*/
/*! \file
This file implements a stack classes FiniteStack. It is
mainly used by the grid iterators where exact knowledge of the stack
implementation is needed to guarantee efficient execution.
*/
/** \brief A stack with static memory allocation
*
This class implements a very efficient stack where the maximum
depth is known in advance. Note that no error checking is
performed!
\param n Maximum number of stack entries
*/
template<class T, int n>
class FiniteStack
: public std::stack<T, Dune::ReservedVector<T,n> >
{
public :
//! Returns true if the stack is full
bool full () const
{
return this->size()>=n;
}
/** Removes and returns the uppermost object from the stack
\warning This differs from the semantics of std::stack, where pop() returns void
*/
T pop ()
{
#ifndef NDEBUG
if (this->empty())
DUNE_THROW(Dune::RangeError, "trying to call pop() on an empty FiniteStack");
#endif
T tmp = this->top();
this->std::stack<T,Dune::ReservedVector<T,n> >::pop();
return tmp;
}
};
}
//! }@
#endif
|