mirror of
https://github.com/Naios/continuable.git
synced 2026-02-09 11:16:40 +08:00
Remove unused static_if
This commit is contained in:
parent
65e41a2cbd
commit
139f7d39de
@ -87,31 +87,6 @@ using void_t = typename detail::deduce_to_void<T...>::type;
|
|||||||
#endif // CONTINUABLE_HAS_CXX17_VOID_T
|
#endif // CONTINUABLE_HAS_CXX17_VOID_T
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename Type, typename TrueCallback>
|
|
||||||
constexpr void static_if_impl(std::true_type, Type&& type,
|
|
||||||
TrueCallback&& trueCallback) {
|
|
||||||
std::forward<TrueCallback>(trueCallback)(std::forward<Type>(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Type, typename TrueCallback>
|
|
||||||
constexpr void static_if_impl(std::false_type, Type&& /*type*/,
|
|
||||||
TrueCallback&& /*trueCallback*/) {
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Type, typename TrueCallback, typename FalseCallback>
|
|
||||||
constexpr auto static_if_impl(std::true_type, Type&& type,
|
|
||||||
TrueCallback&& trueCallback,
|
|
||||||
FalseCallback&& /*falseCallback*/) {
|
|
||||||
return std::forward<TrueCallback>(trueCallback)(std::forward<Type>(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Type, typename TrueCallback, typename FalseCallback>
|
|
||||||
constexpr auto static_if_impl(std::false_type, Type&& type,
|
|
||||||
TrueCallback&& /*trueCallback*/,
|
|
||||||
FalseCallback&& falseCallback) {
|
|
||||||
return std::forward<FalseCallback>(falseCallback)(std::forward<Type>(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Evaluates to the size of the given tuple like type,
|
/// Evaluates to the size of the given tuple like type,
|
||||||
// / if the type has no static size it will be one.
|
// / if the type has no static size it will be one.
|
||||||
template <typename T, typename Enable = void>
|
template <typename T, typename Enable = void>
|
||||||
@ -143,27 +118,6 @@ constexpr auto sequence_of(identity<T>) noexcept {
|
|||||||
return std::make_index_sequence<size>();
|
return std::make_index_sequence<size>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Invokes the callback only if the given type matches the check
|
|
||||||
template <typename Type, typename Check, typename TrueCallback>
|
|
||||||
constexpr void static_if(Type&& type, Check&& check,
|
|
||||||
TrueCallback&& trueCallback) {
|
|
||||||
detail::static_if_impl(std::forward<Check>(check)(type),
|
|
||||||
std::forward<Type>(type),
|
|
||||||
std::forward<TrueCallback>(trueCallback));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Invokes the callback only if the given type matches the check
|
|
||||||
template <typename Type, typename Check, typename TrueCallback,
|
|
||||||
typename FalseCallback>
|
|
||||||
constexpr auto static_if(Type&& type, Check&& check,
|
|
||||||
TrueCallback&& trueCallback,
|
|
||||||
FalseCallback&& falseCallback) {
|
|
||||||
return detail::static_if_impl(std::forward<Check>(check)(type),
|
|
||||||
std::forward<Type>(type),
|
|
||||||
std::forward<TrueCallback>(trueCallback),
|
|
||||||
std::forward<FalseCallback>(falseCallback));
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
/// Calls the given unpacker with the content of the given sequenceable
|
/// Calls the given unpacker with the content of the given sequenceable
|
||||||
template <typename U, typename F, std::size_t... I>
|
template <typename U, typename F, std::size_t... I>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user