summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2012-12-09 15:53:58 +0000
committerrandomdan <randomdan@localhost>2012-12-09 15:53:58 +0000
commit6e0b850688385e9d92f5b11e68969a0512f676da (patch)
tree757090b021751abd782ea864a018c4cfc07670d2
parentSupport default values of different type to target values in options (diff)
downloadproject2-6e0b850688385e9d92f5b11e68969a0512f676da.tar.bz2
project2-6e0b850688385e9d92f5b11e68969a0512f676da.tar.xz
project2-6e0b850688385e9d92f5b11e68969a0512f676da.zip
Add TypePointer, which creates a new instance of its value pointer on assignment from a registered type name string
-rw-r--r--project2/common/typePointer.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/project2/common/typePointer.h b/project2/common/typePointer.h
new file mode 100644
index 0000000..95bf28a
--- /dev/null
+++ b/project2/common/typePointer.h
@@ -0,0 +1,17 @@
+#ifndef TYPEPOINTER_H
+#define TYPEPOINTER_H
+
+template <typename T, typename P = typename boost::intrusive_ptr<T>>
+class TypePointer : public P {
+ public:
+ TypePointer() { }
+ TypePointer(const std::string &) { }
+
+ TypePointer & operator=(const std::string & value) {
+ P::operator=(GenLoader<T>::createNew(value));
+ return *this;
+ }
+};
+
+#endif
+