summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-07-15 21:21:20 +0200
committerljfa-ag <ljfa-ag@web.de>2015-07-15 21:21:20 +0200
commit95f02bc15bb1f45c0d016a2c3f16d451f8da8aaa (patch)
tree33f2671eac57ed3637eaeaf837b4ce3740d96c76 /include
parentea404fc070d15cf53fb6e0099f8e68771da529fd (diff)
downloadProject-Tick-95f02bc15bb1f45c0d016a2c3f16d451f8da8aaa.tar.gz
Project-Tick-95f02bc15bb1f45c0d016a2c3f16d451f8da8aaa.zip
Make tag_array::data private and add accessor
Diffstat (limited to 'include')
-rw-r--r--include/tag_array.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/include/tag_array.h b/include/tag_array.h
index 159e432626..41ec1e573e 100644
--- a/include/tag_array.h
+++ b/include/tag_array.h
@@ -62,6 +62,11 @@ public:
///Constructs an array with the given values
tag_array(std::initializer_list<T> init);
+ tag_array(std::vector<T>&& vec);
+
+ ///Returns a reference to the vector that contains the values
+ std::vector<T>& get();
+ const std::vector<T>& get() const;
/**
* @brief Accesses a value by index with bounds checking
@@ -98,7 +103,7 @@ public:
const_iterator cbegin() const;
const_iterator cend() const;
- ///The vector that holds the values
+private:
std::vector<T> data;
};
@@ -115,6 +120,23 @@ tag_array<T>::tag_array(std::initializer_list<T> init):
{}
template<class T>
+tag_array<T>::tag_array(std::vector<T>&& vec):
+ data(std::move(vec))
+{}
+
+template<class T>
+std::vector<T>& tag_array<T>::get()
+{
+ return data;
+}
+
+template<class T>
+const std::vector<T>& tag_array<T>::get() const
+{
+ return data;
+}
+
+template<class T>
T& tag_array<T>::at(size_t i)
{
return data.at(i);
@@ -172,7 +194,7 @@ template<class T> auto tag_array<T>::cend() const -> const_iterator { return d
template<class T>
bool operator==(const tag_array<T>& lhs, const tag_array<T>& rhs)
{
- return lhs.data == rhs.data;
+ return lhs.get() == rhs.get();
}
template<class T>