diff options
author | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-11-13 15:57:24 +0000 |
---|---|---|
committer | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-11-13 15:57:24 +0000 |
commit | 5cf6e0ec3fb49f0cd360e08f1e7d08dee1590f32 (patch) | |
tree | 88c657bfed291e6aa59c0655ca65ac29435519b3 /misc/optvec.hpp | |
parent | bed009fae6f3bc97a0188fe1548490e575e9d3e1 (diff) | |
download | opt-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.hpp | 31 |
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); + } + }; +}; |