-
Notifications
You must be signed in to change notification settings - Fork 0
/
Container.h
48 lines (40 loc) · 853 Bytes
/
Container.h
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
#pragma once
#include <deque>
template <typename T>
class Container : public std::deque<T>
{
using iterator = typename std::deque<T>::iterator;
using size_type = typename std::deque<T>::size_type;
using parent = std::deque<T>;
public:
Container() = default;
iterator begin() noexcept
{
return parent::begin();
}
iterator end() noexcept
{
return parent::end();
}
void next(iterator& iterator)
{
iterator = std::next(iterator);
if (iterator == parent::end())
{
iterator = parent::begin();
}
}
template<class... Args>
T& emplace_back(Args&&... args)
{
return parent::emplace_back(std::forward<Args>(args)...);
}
template<class... Args>
void emplace_back_multiple(const size_type count, Args&&... args)
{
for (size_type i = 0; i < count; ++i)
{
parent::emplace_back(std::forward<Args>(args)...);
}
}
};