mirror of
https://github.com/Naios/continuable.git
synced 2026-02-08 10:46:40 +08:00
Remove unused identity utilities
This commit is contained in:
parent
83f736a93f
commit
65e41a2cbd
@ -41,10 +41,6 @@
|
|||||||
namespace cti {
|
namespace cti {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
namespace traits {
|
namespace traits {
|
||||||
/// Evaluates to the element at position I.
|
|
||||||
template <std::size_t I, typename... Args>
|
|
||||||
using at_t = decltype(std::get<I>(std::declval<std::tuple<Args...>>()));
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
struct index_of_impl;
|
struct index_of_impl;
|
||||||
@ -64,31 +60,16 @@ using index_of_t = detail::index_of_impl<T, Args...>;
|
|||||||
/// A tagging type for wrapping other types
|
/// A tagging type for wrapping other types
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
struct identity {};
|
struct identity {};
|
||||||
template <typename T>
|
|
||||||
struct identity<T> : std::common_type<T> {};
|
|
||||||
|
|
||||||
template <typename>
|
template <typename>
|
||||||
struct is_identity : std::false_type {};
|
struct is_identity : std::false_type {};
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct is_identity<identity<Args...>> : std::true_type {};
|
struct is_identity<identity<Args...>> : std::true_type {};
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
constexpr identity<std::decay_t<T>> identity_of(T const& /*type*/) noexcept {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
template <typename... Args>
|
|
||||||
constexpr identity<Args...> identity_of(identity<Args...> /*type*/) noexcept {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using identify = std::conditional_t<is_identity<std::decay_t<T>>::value, T,
|
using identify = std::conditional_t<is_identity<std::decay_t<T>>::value, T,
|
||||||
identity<std::decay_t<T>>>;
|
identity<std::decay_t<T>>>;
|
||||||
|
|
||||||
template <std::size_t I, typename... T>
|
|
||||||
constexpr auto get(identity<T...>) noexcept {
|
|
||||||
return identify<at_t<I, T...>>{};
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(CONTINUABLE_HAS_CXX17_VOID_T)
|
#if defined(CONTINUABLE_HAS_CXX17_VOID_T)
|
||||||
using std::void_t;
|
using std::void_t;
|
||||||
#else
|
#else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user