summaryrefslogtreecommitdiff
path: root/include/mbgl/util/unique_any.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/util/unique_any.hpp')
-rw-r--r--include/mbgl/util/unique_any.hpp26
1 files changed, 1 insertions, 25 deletions
diff --git a/include/mbgl/util/unique_any.hpp b/include/mbgl/util/unique_any.hpp
index d488930a03..b84069c2e4 100644
--- a/include/mbgl/util/unique_any.hpp
+++ b/include/mbgl/util/unique_any.hpp
@@ -222,35 +222,11 @@ template<typename ValueType>
inline ValueType* any_cast(unique_any* any)
{
if(any == nullptr || any->type() != typeid(ValueType))
- return nullptr;
+ throw bad_any_cast();
else
return any->cast<ValueType>();
}
-template<typename ValueType, typename _Vt = std::decay_t<ValueType> >
-inline ValueType any_cast(const unique_any& any)
-{
- static_assert(std::is_constructible<ValueType, const _Vt&>::value,
- "any_cast type can't construct copy of contained object");
- auto temp = any_cast<_Vt>(&any);
- if (temp == nullptr) {
- throw bad_any_cast();
- }
- return static_cast<ValueType>(*temp);
-}
-
-template<typename ValueType, typename _Vt = std::decay_t<ValueType> >
-inline ValueType any_cast(unique_any& any)
-{
- static_assert(std::is_constructible<ValueType, const _Vt&>::value,
- "any_cast type can't construct copy of contained object");
- auto temp = any_cast<_Vt>(&any);
- if (temp == nullptr) {
- throw bad_any_cast();
- }
- return static_cast<ValueType>(*temp);
-}
-
template<typename ValueType, typename _Vt = std::remove_cv_t<ValueType> >
inline ValueType any_cast(unique_any&& any)
{