-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStack.h
More file actions
43 lines (31 loc) · 925 Bytes
/
Stack.h
File metadata and controls
43 lines (31 loc) · 925 Bytes
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
#pragma once
#include "StackImplementation.h"
#include "VectorStack.h"
#include "ListStack.h"
#include <stdexcept>
#include <cstddef>
using ValueType = double;
enum class StackContainer {
Vector = 0,
List,
};
class IStackImplementation;
class Stack {
public:
Stack(StackContainer container = StackContainer::Vector);
Stack(const ValueType* valueArray, size_t arraySize,
StackContainer container = StackContainer::Vector);
explicit Stack(const Stack& copyStack);
Stack& operator=(const Stack& copyStack);
Stack(Stack&& moveStack) noexcept;
Stack& operator=(Stack&& moveStack) noexcept;
~Stack();
void push(const ValueType& value);
void pop();
[[nodiscard]] const ValueType& top() const;
[[nodiscard]] bool isEmpty() const;
[[nodiscard]] size_t size() const;
private:
IStackImplementation* _pimpl = nullptr;
StackContainer _containerType;
};