зеркало из
https://github.com/iharh/notes.git
synced 2025-10-30 13:16:07 +02:00
24 строки
502 B
Plaintext
24 строки
502 B
Plaintext
- "typename" is a synonym of "class" in template declaration
|
|
|
|
- Template template parameters
|
|
|
|
// basics/stack7decl.hpp
|
|
|
|
template <typename T,
|
|
template <typename ELEM> class CONT = std::deque
|
|
>
|
|
class Stack
|
|
{
|
|
private:
|
|
CONT<T> elems; // elements
|
|
|
|
public:
|
|
void push(T const &); // push element
|
|
void pop(); // pop element
|
|
T top() const; // return top element
|
|
bool empty() const // return whether the stack is empty
|
|
{
|
|
return elems.empty();
|
|
}
|
|
};
|