diff --git a/src/framework/stdext/packed_any.h b/src/framework/stdext/packed_any.h index 02ca7ace..dc4e2249 100644 --- a/src/framework/stdext/packed_any.h +++ b/src/framework/stdext/packed_any.h @@ -89,18 +89,22 @@ public: }; template -T packed_any_cast(const packed_any& operand) { - if(operand.scalar) { - union { - T v; - packed_any::placeholder* content; - }; - content = operand.content; - return v; - } else { - assert(operand.type() == typeid(T)); - return static_cast*>(operand.content)->held; - } +typename std::enable_if::value, T>::type +packed_any_cast(const packed_any& operand) { + assert(operand.scalar); + union { + T v; + packed_any::placeholder* content; + }; + content = operand.content; + return v; +} + +template +typename std::enable_if::value, T>::type +packed_any_cast(const packed_any& operand) { + assert(operand.type() == typeid(T)); + return static_cast*>(operand.content)->held; } template T packed_any::cast() const { return packed_any_cast(*this); } diff --git a/src/framework/stdext/packed_vector.h b/src/framework/stdext/packed_vector.h index 6ac1a0fd..8cf34091 100644 --- a/src/framework/stdext/packed_vector.h +++ b/src/framework/stdext/packed_vector.h @@ -42,7 +42,7 @@ public: packed_vector() : m_size(0), m_data(nullptr) { } packed_vector(size_type size) : m_size(size), m_data(new T[size]) { } - packed_vector(size_type size, const T& value) : m_size(size), m_data(new T[size](value)) { } + packed_vector(size_type size, const T& value) : m_size(size), m_data(new T[size]) { std::fill(begin(), end(), value); } template packed_vector(InputIterator first, InputIterator last) : m_size(last - first), m_data(new T[m_size]) { std::copy(first, last, m_data); } packed_vector(const packed_vector& other) : m_size(other.m_size), m_data(new T[other.m_size]) { std::copy(other.begin(), other.end(), m_data); }