Fix compile issues with clang
This commit is contained in:
parent
4f0e00fdfa
commit
103daa63e3
|
@ -89,18 +89,22 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T packed_any_cast(const packed_any& operand) {
|
typename std::enable_if<can_pack_in_any<T>::value, T>::type
|
||||||
if(operand.scalar) {
|
packed_any_cast(const packed_any& operand) {
|
||||||
|
assert(operand.scalar);
|
||||||
union {
|
union {
|
||||||
T v;
|
T v;
|
||||||
packed_any::placeholder* content;
|
packed_any::placeholder* content;
|
||||||
};
|
};
|
||||||
content = operand.content;
|
content = operand.content;
|
||||||
return v;
|
return v;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
typename std::enable_if<!can_pack_in_any<T>::value, T>::type
|
||||||
|
packed_any_cast(const packed_any& operand) {
|
||||||
assert(operand.type() == typeid(T));
|
assert(operand.type() == typeid(T));
|
||||||
return static_cast<packed_any::holder<T>*>(operand.content)->held;
|
return static_cast<packed_any::holder<T>*>(operand.content)->held;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> T packed_any::cast() const { return packed_any_cast<T>(*this); }
|
template<typename T> T packed_any::cast() const { return packed_any_cast<T>(*this); }
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
packed_vector() : m_size(0), m_data(nullptr) { }
|
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) : 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 <class InputIterator>
|
template <class InputIterator>
|
||||||
packed_vector(InputIterator first, InputIterator last) : m_size(last - first), m_data(new T[m_size]) { std::copy(first, last, m_data); }
|
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<T>& other) : m_size(other.m_size), m_data(new T[other.m_size]) { std::copy(other.begin(), other.end(), m_data); }
|
packed_vector(const packed_vector<T>& other) : m_size(other.m_size), m_data(new T[other.m_size]) { std::copy(other.begin(), other.end(), m_data); }
|
||||||
|
|
Loading…
Reference in New Issue