26 #ifndef ICL_CORE_SEARCHABLE_STACK_H_INCLUDED 27 #define ICL_CORE_SEARCHABLE_STACK_H_INCLUDED 41 template <
typename T,
typename TCompare = std::equal_to<T>,
typename TAlloc = std::allocator<T> >
52 typedef typename std::vector<T>::size_type
size_type;
58 void clear() { std::vector<T, TAlloc>::clear(); }
60 bool empty()
const {
return std::vector<T, TAlloc>::empty(); }
62 size_type
size()
const {
return std::vector<T, TAlloc>::size(); }
67 void pop() { std::vector<T, TAlloc>::pop_back(); }
74 const_iterator
begin()
const {
return std::vector<T, TAlloc>::begin(); }
76 const_iterator
end()
const {
return std::vector<T, TAlloc>::end(); }
78 const_reverse_iterator
rbegin()
const {
return std::vector<T, TAlloc>::rbegin(); }
80 const_reverse_iterator
rend()
const {
return std::vector<T, TAlloc>::rend(); }
85 for (const_iterator it =
begin(); it !=
end(); ++it)
87 if (
m_comp(*it, t)) {
return it; }
bool empty() const
Returns true if the stack is empty.
Helper definitions for template programming.
const_iterator find(typename ConvertToRef< T >::ToConstRef t) const
Finds a specific element on the stack by linear search.
ConvertToRef< T >::ToConstRef top() const
Returns a const reference to the top stack element.
SearchableStack< int16_t > Signed16SearchableStack
void pop()
Pops an element off the stack.
SearchableStack< int8_t > Signed8SearchableStack
const_iterator begin() const
Returns an iterator to the bottom element of the stack.
ConvertToRef< T >::ToRef top()
Returns a reference to the top stack element.
const_iterator end() const
Returns an iterator to the top end of the stack.
SearchableStack< uint16_t > Unsigned16SearchableStack
const_reverse_iterator rend() const
Returns a reverse iterator to the bottom end of the stack.
SearchableStack< double > DoubleSearchableStack
SearchableStack< uint8_t > Unsigned8SearchableStack
const_reverse_iterator rbegin() const
Returns a reverse iterator to the top element of the stack.
SearchableStack< uint64_t > Unsigned64SearchableStack
SearchableStack()
Constructs an empty stack.
SearchableStack< float > FloaSearchableStack
SearchableStack< uint32_t > Unsigned32SearchableStack
std::vector< T >::const_iterator const_iterator
size_type size() const
Returns the number of elements on the stack.
void clear()
Clears the stack.
std::vector< T >::size_type size_type
Size type.
Contains Interface base classes and base types.
SearchableStack< int64_t > Signed64SearchableStack
void push(typename ConvertToRef< T >::ToConstRef t)
Pushes an element onto the stack.
std::vector< T >::const_reverse_iterator const_reverse_iterator
Const reverse iterator type.
SearchableStack< int32_t > Signed32SearchableStack