diff --git a/include/etl/experimental/uni_type.h b/include/etl/experimental/uni_type.h index d5840321..1aec8899 100644 --- a/include/etl/experimental/uni_type.h +++ b/include/etl/experimental/uni_type.h @@ -6,6 +6,13 @@ public: static constexpr size_t Size = Size_; + //*********************************** + template + uni_type(const uni_type& other) + { + memcpy(buffer, other.buffer, Size_); + } + //*********************************** template T& get() @@ -20,12 +27,22 @@ public: return *reinterpret_cast(buffer); } + //*********************************** template operator T() { return *reinterpret_cast(buffer); } + //*********************************** + template + uni_type& operator =(const uni_type& rhs) + { + memcpy(buffer, rhs.buffer, Size_); + + return *this; + } + //*********************************** constexpr size_t size() const { @@ -37,8 +54,6 @@ private: char buffer[Size] }; - - template class uni_type_ptr { @@ -46,6 +61,18 @@ public: static constexpr size_t Size = Size_; + //*********************************** + uni_type_ptr() + : pbuffer(ETL_NULLPTR) + { + } + + //*********************************** + uni_type_ptr(void* pbuffer_) + : pbuffer(reinterpret_cast(pbuffer)) + { + } + //*********************************** template T& get() @@ -75,4 +102,4 @@ public: private: char* pbuffer; -}; \ No newline at end of file +};