diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-17 17:11:51 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-17 17:11:51 +0100 |
commit | 93c065174e1aa306ee724dd523ef6b2254c1d388 (patch) | |
tree | a25f24f8905e490aab89f4437ca639ea57a430ab /src/core/managed | |
parent | 3e124a41f14fa3a76febba09f4b58b3f5361efdb (diff) |
Some (slight) changes to existing structures and first attempts on a test to construct a test comain and a test document out of thin air. I am, indeed, an alchemist.
Diffstat (limited to 'src/core/managed')
-rw-r--r-- | src/core/managed/ManagedContainer.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/managed/ManagedContainer.hpp b/src/core/managed/ManagedContainer.hpp index 19bff3f..6bf1915 100644 --- a/src/core/managed/ManagedContainer.hpp +++ b/src/core/managed/ManagedContainer.hpp @@ -32,6 +32,7 @@ #include <unordered_set> #include <vector> #include <map> +#include <stdexcept> #include <type_traits> #include "Manager.hpp" @@ -496,6 +497,16 @@ public: } Base::c.pop_back(); } + + Rooted<T> operator[](int i) const { + for (const_iterator it = Base::cbegin(); it != Base::cend(); it++) { + if (i == 0) { + return Rooted<T>(*it); + } + i--; + } + throw std::out_of_range(std::to_string(i) + " is out of range!"); + } }; /** |