aboutsummaryrefslogtreecommitdiffstats
path: root/misc/optvec.hpp
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-11-13 15:57:24 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-11-13 15:57:24 +0000
commit5cf6e0ec3fb49f0cd360e08f1e7d08dee1590f32 (patch)
tree88c657bfed291e6aa59c0655ca65ac29435519b3 /misc/optvec.hpp
parentbed009fae6f3bc97a0188fe1548490e575e9d3e1 (diff)
downloadopt-utilities-5cf6e0ec3fb49f0cd360e08f1e7d08dee1590f32.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@94 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'misc/optvec.hpp')
-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);
+ }
+ };
+};