blob: 94acb8c32d4fab511c1d39216a171ec19666f6d7 (
plain)
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
|
#pragma once
#include <algorithm>
#include <iterator>
#include <vector>
// Implementing this base class allows an object to be collection of objects.
template <typename T>
class CollectionBase
{
public:
void Append(T const & collector)
{
m_collection.push_back(collector);
}
void AddCollection(CollectionBase<T> const & collection)
{
std::copy(std::begin(collection.m_collection), std::end(collection.m_collection),
std::back_inserter(m_collection));
}
std::vector<T> const & GetCollection() const
{
return m_collection;
}
bool Empty() const
{
return m_collection.empty();
}
protected:
std::vector<T> m_collection;
};
|