diff --git a/include/etl/experimental/uni_type.h b/include/etl/experimental/uni_type.h new file mode 100644 index 00000000..d5840321 --- /dev/null +++ b/include/etl/experimental/uni_type.h @@ -0,0 +1,78 @@ +#pragma once +template +class uni_type +{ +public: + + static constexpr size_t Size = Size_; + + //*********************************** + template + T& get() + { + return *reinterpret_cast(buffer); + } + + //*********************************** + template + const T& get() const + { + return *reinterpret_cast(buffer); + } + + template + operator T() + { + return *reinterpret_cast(buffer); + } + + //*********************************** + constexpr size_t size() const + { + return Size; + } + +private: + + char buffer[Size] +}; + + + +template +class uni_type_ptr +{ +public: + + static constexpr size_t Size = Size_; + + //*********************************** + template + T& get() + { + return *reinterpret_cast(pbuffer); + } + + //*********************************** + template + const T& get() const + { + return *reinterpret_cast(pbuffer); + } + + template + operator T() + { + return *reinterpret_cast(pbuffer); + } + + //*********************************** + constexpr size_t size() const + { + return Size; + } + +private: + + char* pbuffer; +}; \ No newline at end of file diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index 747b9512..14e74a75 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -1113,6 +1113,9 @@ ETL\Utilities + + ETL\Experimental +