Strong typedef for a type T.
Typical usage:
Or:
using StrongTypedef::StrongTypedef;
};
Has all the:
- comparison (see "Operators" below)
- hashing
- streaming operators
- optimizaed logging for LOG_XXX()
If used with container-like type also has common STL functions:
- begin()
- end()
- cbegin()
- cend()
- size()
- empty()
- clear()
- operator[]
Operators: You can customize the operators that are available by passing the third argument of type StrongTypedefOps. See its docs for more info.
- Examples
- postgresql/functional_tests/basic_chaos/postgres_service.cpp, samples/digest_auth_service/auth_digest.cpp, samples/postgres_auth/auth_bearer.cpp, samples/postgres_auth/user_info_cache.hpp, samples/postgres_service/postgres_service.cpp, and samples/s3api/src/s3api_client.cpp.
Definition at line 177 of file strong_typedef.hpp.
|
| StrongTypedef (const StrongTypedef &)=default |
|
| StrongTypedef (StrongTypedef &&) noexcept=default |
|
StrongTypedef & | operator= (const StrongTypedef &)=default |
|
StrongTypedef & | operator= (StrongTypedef &&) noexcept=default |
|
constexpr | StrongTypedef (impl::strong_typedef::InitializerList< T > lst) |
|
template<typename... Args, typename = std::enable_if_t<std::is_constructible_v<T, Args...>>> |
constexpr | StrongTypedef (Args &&... args) noexcept(noexcept(T(std::forward< Args >(args)...))) |
|
constexpr | operator const T & () const &noexcept |
|
constexpr | operator T () &&noexcept |
|
constexpr | operator T& () &noexcept |
|
constexpr const T & | GetUnderlying () const &noexcept |
|
constexpr T | GetUnderlying () &&noexcept |
|
constexpr T & | GetUnderlying () &noexcept |
|
template<typename Void = void, typename = impl::strong_typedef::EnableIfRange<T, Void>> |
auto | begin () |
|
template<typename Void = void, typename = impl::strong_typedef::EnableIfRange<T, Void>> |
auto | end () |
|
template<typename Void = void, typename = impl::strong_typedef::EnableIfRange<const T, Void>> |
auto | begin () const |
|
template<typename Void = void, typename = impl::strong_typedef::EnableIfRange<const T, Void>> |
auto | end () const |
|
template<typename Void = void, typename = impl::strong_typedef::EnableIfRange<const T, Void>> |
auto | cbegin () const |
|
template<typename Void = void, typename = impl::strong_typedef::EnableIfRange<const T, Void>> |
auto | cend () const |
|
template<typename Void = void, typename = impl::strong_typedef::EnableIfSizeable<const T, Void>> |
auto | size () const |
|
auto | empty () const |
|
auto | clear () |
|
template<class Arg > |
decltype(auto) | operator[] (Arg &&i) |
|
template<class Arg > |
decltype(auto) | operator[] (Arg &&i) const |
|