mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Some minor qualifier and naming improvements
This commit is contained in:
parent
aa0f0db0cd
commit
7c0f6f897b
@ -776,7 +776,7 @@ public:
|
|||||||
using T::operator();
|
using T::operator();
|
||||||
|
|
||||||
/// Returns the underlaying signature hint
|
/// Returns the underlaying signature hint
|
||||||
constexpr Hint hint() const noexcept { return {}; }
|
static constexpr Hint hint() noexcept { return {}; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
@ -787,7 +787,7 @@ constexpr auto make_invoker(T&& invoke, signature_hint_tag<Args...>) {
|
|||||||
|
|
||||||
/// - continuable<?...> -> result(nextCallback);
|
/// - continuable<?...> -> result(nextCallback);
|
||||||
template <typename Data, typename Annotation>
|
template <typename Data, typename Annotation>
|
||||||
constexpr auto invokerOf(util::identity<continuable_base<Data, Annotation>>) {
|
constexpr auto invoker_of(util::identity<continuable_base<Data, Annotation>>) {
|
||||||
/// Get the hint of the unwrapped returned continuable
|
/// Get the hint of the unwrapped returned continuable
|
||||||
using Type = decltype(attorney::materialize(
|
using Type = decltype(attorney::materialize(
|
||||||
std::declval<continuable_base<Data, Annotation>>()));
|
std::declval<continuable_base<Data, Annotation>>()));
|
||||||
@ -805,7 +805,7 @@ constexpr auto invokerOf(util::identity<continuable_base<Data, Annotation>>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// - ? -> nextCallback(?)
|
/// - ? -> nextCallback(?)
|
||||||
template <typename T> auto invokerOf(util::identity<T>) {
|
template <typename T> auto invoker_of(util::identity<T>) {
|
||||||
return make_invoker(
|
return make_invoker(
|
||||||
[](auto&& callback, auto&& nextCallback, auto&&... args) {
|
[](auto&& callback, auto&& nextCallback, auto&&... args) {
|
||||||
auto result = std::forward<decltype(callback)>(callback)(
|
auto result = std::forward<decltype(callback)>(callback)(
|
||||||
@ -817,7 +817,7 @@ template <typename T> auto invokerOf(util::identity<T>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// - void -> nextCallback()
|
/// - void -> nextCallback()
|
||||||
inline auto invokerOf(util::identity<void>) {
|
inline auto invoker_of(util::identity<void>) {
|
||||||
return make_invoker(
|
return make_invoker(
|
||||||
[](auto&& callback, auto&& nextCallback, auto&&... args) {
|
[](auto&& callback, auto&& nextCallback, auto&&... args) {
|
||||||
std::forward<decltype(callback)>(callback)(
|
std::forward<decltype(callback)>(callback)(
|
||||||
@ -830,7 +830,7 @@ inline auto invokerOf(util::identity<void>) {
|
|||||||
|
|
||||||
/// Returns a sequenced invoker which is able to invoke
|
/// Returns a sequenced invoker which is able to invoke
|
||||||
/// objects where std::get is applicable.
|
/// objects where std::get is applicable.
|
||||||
inline auto sequencedUnpackInvoker() {
|
inline auto sequenced_unpack_invoker() {
|
||||||
return [](auto&& callback, auto&& nextCallback, auto&&... args) {
|
return [](auto&& callback, auto&& nextCallback, auto&&... args) {
|
||||||
auto result = std::forward<decltype(callback)>(callback)(
|
auto result = std::forward<decltype(callback)>(callback)(
|
||||||
std::forward<decltype(args)>(args)...);
|
std::forward<decltype(args)>(args)...);
|
||||||
@ -846,15 +846,15 @@ inline auto sequencedUnpackInvoker() {
|
|||||||
|
|
||||||
// - std::pair<?, ?> -> nextCallback(?, ?)
|
// - std::pair<?, ?> -> nextCallback(?, ?)
|
||||||
template <typename First, typename Second>
|
template <typename First, typename Second>
|
||||||
constexpr auto invokerOf(util::identity<std::pair<First, Second>>) {
|
constexpr auto invoker_of(util::identity<std::pair<First, Second>>) {
|
||||||
return make_invoker(sequencedUnpackInvoker(),
|
return make_invoker(sequenced_unpack_invoker(),
|
||||||
util::identity<First, Second>{});
|
util::identity<First, Second>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
// - std::tuple<?...> -> nextCallback(?...)
|
// - std::tuple<?...> -> nextCallback(?...)
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
constexpr auto invokerOf(util::identity<std::tuple<Args...>>) {
|
constexpr auto invoker_of(util::identity<std::tuple<Args...>>) {
|
||||||
return make_invoker(sequencedUnpackInvoker(), util::identity<Args...>{});
|
return make_invoker(sequenced_unpack_invoker(), util::identity<Args...>{});
|
||||||
}
|
}
|
||||||
} // end namespace decoration
|
} // end namespace decoration
|
||||||
|
|
||||||
@ -929,7 +929,7 @@ void invoke_proxy(signature_hint_tag<Args...>, Continuation&& continuation,
|
|||||||
util::identity_of<decltype(std::move(callback)(std::move(args)...))>();
|
util::identity_of<decltype(std::move(callback)(std::move(args)...))>();
|
||||||
|
|
||||||
// Pick the correct invoker that handles decorating of the result
|
// Pick the correct invoker that handles decorating of the result
|
||||||
auto invoker = decoration::invokerOf(result);
|
auto invoker = decoration::invoker_of(result);
|
||||||
|
|
||||||
// Invoke the callback
|
// Invoke the callback
|
||||||
packed_dispatch(std::move(executor), std::move(invoker),
|
packed_dispatch(std::move(executor), std::move(invoker),
|
||||||
@ -942,7 +942,7 @@ void invoke_proxy(signature_hint_tag<Args...>, Continuation&& continuation,
|
|||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
constexpr auto next_hint_of(util::identity<T> /*callback*/,
|
constexpr auto next_hint_of(util::identity<T> /*callback*/,
|
||||||
signature_hint_tag<Args...> /*current*/) {
|
signature_hint_tag<Args...> /*current*/) {
|
||||||
return decoration::invokerOf(util::identity_of<decltype(std::declval<T>()(
|
return decoration::invoker_of(util::identity_of<decltype(std::declval<T>()(
|
||||||
std::declval<Args>()...))>())
|
std::declval<Args>()...))>())
|
||||||
.hint();
|
.hint();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,10 +20,10 @@
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <functional>
|
|
||||||
#include <system_error>
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
|
||||||
struct continuable_base {
|
struct continuable_base {
|
||||||
template <typename T> continuable_base& then(T&&) { return *this; }
|
template <typename T> continuable_base& then(T&&) { return *this; }
|
||||||
@ -35,9 +35,10 @@ struct continuable_base {
|
|||||||
template <typename T> continuable_base& failed(T&&) { return *this; }
|
template <typename T> continuable_base& failed(T&&) { return *this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Result>
|
template <typename... Result> struct accumulator {
|
||||||
struct accumulator {
|
auto accumulate() {
|
||||||
auto accumulate() { return [] {}; }
|
return [] {};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Accumulator, typename... Initial>
|
template <typename Accumulator, typename... Initial>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user