aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--misc/optvec.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/misc/optvec.hpp b/misc/optvec.hpp
new file mode 100644
index 0000000..5cb78c1
--- /dev/null
+++ b/misc/optvec.hpp
@@ -0,0 +1,31 @@
+#include <vector>
+
+namespace opt_utilities
+{
+ template <typename T>
+ class optvec
+ :public std::vector<T>
+ {
+ public:
+ optvec()
+ {}
+
+ optvec(size_t s)
+ :std::vector<T>(s)
+ {}
+
+ optvec(const std::vector<T>& rhs)
+ :std::vector<T>(rhs)
+ {}
+ public:
+ operator std::vector<T>& ()
+ {
+ return dynamic_cast<std::vector<T>&>(*this);
+ }
+
+ operator const std::vector<T>& ()const
+ {
+ return dynamic_cast<const std::vector<T>&>(*this);
+ }
+ };
+};