#pragma once #include "typetraits.h" /** * Helper type that can be used as one of the parameters in function declaration * to limit the number of types this function can be called with. * * Example usage: * @code * void CharOnlyFunction(TExplicitType value); * void AnythingFunction(char value); * * CharOnlyFunction('c'); // Works. * CharOnlyFunction(1); // Compilation error. * CharOnlyFunction(1ull); // Compilation error. * * AnythingFunction('c'); // Works. * AnythingFunction(1); // Works. * AnythingFunction(1ull); // Works. * @endcode */ template class TExplicitType { public: template TExplicitType(const OtherT& value, std::enable_if_t::value>* = nullptr) noexcept : Value_(value) { } const T& Value() const noexcept { return Value_; } operator const T&() const noexcept { return Value_; } private: const T& Value_; };