Fix compile issues with clang
This commit is contained in:
		
							parent
							
								
									4f0e00fdfa
								
							
						
					
					
						commit
						103daa63e3
					
				|  | @ -89,18 +89,22 @@ public: | |||
| }; | ||||
| 
 | ||||
| template<typename T> | ||||
| 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<packed_any::holder<T>*>(operand.content)->held; | ||||
|     } | ||||
| typename std::enable_if<can_pack_in_any<T>::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 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)); | ||||
|     return static_cast<packed_any::holder<T>*>(operand.content)->held; | ||||
| } | ||||
| 
 | ||||
| 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(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> | ||||
|     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); } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Eduardo Bart
						Eduardo Bart