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 b/test/vs2019/etl.vcxproj index 2836b588..d6802bf2 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -1309,6 +1309,7 @@ + diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index fbe70298..1efda090 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -106,6 +106,9 @@ {562466b5-677d-4448-9e9e-f70805cd71ad} + + {79c578f6-5400-4b4d-b2a4-9a8c589f7c81} + @@ -1107,6 +1110,9 @@ ETL\Private + + ETL\Experimental +