mirror of
https://github.com/Naios/continuable.git
synced 2026-02-09 11:16:40 +08:00
finish correct
This commit is contained in:
parent
4aff0684fb
commit
65fc107137
@ -432,10 +432,14 @@ namespace detail
|
|||||||
return std::forward<_CTy>(continuable);
|
return std::forward<_CTy>(continuable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Correct user given continuable functionals.
|
||||||
|
/// Converts plan continuables to continuable retuning functions.
|
||||||
|
/// Converts void return to empty continuable.
|
||||||
template<typename _CTy>
|
template<typename _CTy>
|
||||||
static int correct(_CTy&&)
|
static auto correct(_CTy&& functional)
|
||||||
|
-> decltype(remove_void_trait(box_continuable_trait(std::declval<_CTy>())))
|
||||||
{
|
{
|
||||||
return 1;
|
return remove_void_trait(box_continuable_trait(std::forward<_CTy>(functional)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
6
test.cpp
6
test.cpp
@ -236,11 +236,11 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
auto test1 = detail::functional_traits<>::remove_void_trait([]
|
auto test1 = detail::functional_traits<>::correct([]
|
||||||
{
|
{
|
||||||
});
|
});
|
||||||
|
|
||||||
auto test2 = detail::functional_traits<>::remove_void_trait([]
|
auto test2 = detail::functional_traits<>::correct([]
|
||||||
{
|
{
|
||||||
return make_continuable([](Callback<int, int>&& callback)
|
return make_continuable([](Callback<int, int>&& callback)
|
||||||
{
|
{
|
||||||
@ -249,6 +249,8 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
auto test3 = detail::functional_traits<>::correct(make_continuable());
|
||||||
|
|
||||||
std::cout << "ok" << std::endl;
|
std::cout << "ok" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user