Program Listing for File unwrap_named.hpp
↰ Return to documentation for file (include/eat/utilities/unwrap_named.hpp)
#pragma once
#include <adm/detail/named_type.hpp>
namespace eat::utilities {
namespace detail {
template <typename T>
struct UnwrapNamedType {
template <typename U>
U operator()(U &&value) {
return value;
}
using type = T;
};
template <typename T, typename Tag, typename stdalidator>
struct UnwrapNamedType<adm::detail::NamedType<T, Tag, stdalidator>> {
template <typename U>
auto &&operator()(U &&value) {
return value.get();
}
using type = T;
};
} // namespace detail
template <typename T>
using unwrap_named_t = typename detail::UnwrapNamedType<T>::type;
template <typename T>
auto unwrap_named(T &&value) -> decltype(detail::UnwrapNamedType<std::remove_cvref_t<T>>{}(std::forward<T>(value))) {
return detail::UnwrapNamedType<std::remove_cvref_t<T>>{}(std::forward<T>(value));
}
} // namespace eat::utilities