summaryrefslogtreecommitdiff
path: root/include/value.h
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-08-05 17:06:40 +0200
committerljfa-ag <ljfa-ag@web.de>2015-08-05 17:06:40 +0200
commit7626425b2c6299b38865aa10c8d912e946f5f88f (patch)
tree9dfdc531294bc7b6933a459307941f779e662b21 /include/value.h
parentb79ebd5096321cf8051f483bc20ac11fab9f9d6c (diff)
downloadProject-Tick-7626425b2c6299b38865aa10c8d912e946f5f88f.tar.gz
Project-Tick-7626425b2c6299b38865aa10c8d912e946f5f88f.zip
Add tag::as method
Diffstat (limited to 'include/value.h')
-rw-r--r--include/value.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/include/value.h b/include/value.h
index c017bcbd27..4865c8fd1c 100644
--- a/include/value.h
+++ b/include/value.h
@@ -93,7 +93,7 @@ public:
const tag& get() const;
/**
- * @brief Returns the contained tag as an instance of T
+ * @brief Returns a reference to the contained tag as an instance of T
* @throw std::bad_cast if the tag is not of type T
*/
template<class T>
@@ -207,15 +207,13 @@ private:
template<class T>
T& value::as()
{
- static_assert(std::is_base_of<tag, T>::value, "T must be a subclass of tag");
- return dynamic_cast<T&>(get());
+ return tag_->as<T>();
}
template<class T>
const T& value::as() const
{
- static_assert(std::is_base_of<tag, T>::value, "T must be a subclass of tag");
- return dynamic_cast<T&>(get());
+ return tag_->as<T>();;
}
}