diff --git a/include/utempl/reference_wrapper.hpp b/include/utempl/reference_wrapper.hpp new file mode 100644 index 0000000..5d3e172 --- /dev/null +++ b/include/utempl/reference_wrapper.hpp @@ -0,0 +1,41 @@ +#pragma once + +namespace utempl { +template +struct ReferenceWrapper; + +template +struct ReferenceWrapper { + inline constexpr auto operator*() -> T& { + return this->value; + }; + inline constexpr auto operator->() -> T* { + return &this->value; + }; + T&& value; +}; + +template +struct ReferenceWrapper { + inline constexpr auto operator*() -> const T& { + return this->value; + }; + inline constexpr auto operator->() -> const T* { + return &this->value; + }; + const T& value; +}; + +template +struct ReferenceWrapper { + + inline constexpr auto operator*() -> T& { + return this->value; + }; + inline constexpr auto operator->() -> T* { + return &this->value; + }; + T& value; +}; + +} // namespace utempl