mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
correct a forward call
This commit is contained in:
parent
01d38964a7
commit
44e96ac52b
@ -328,7 +328,7 @@ namespace detail
|
||||
template<typename _CTy>
|
||||
static std::function<Continuable<>(_ATy...)> wrap(_CTy&& functional)
|
||||
{
|
||||
return [functional](_ATy... args)
|
||||
return [functional](_ATy&&... args)
|
||||
{
|
||||
// Invoke the original callback
|
||||
functional(std::forward<_ATy>(args)...);
|
||||
|
||||
25
test.cpp
25
test.cpp
@ -72,6 +72,22 @@ Continuable<bool> Validate()
|
||||
});
|
||||
}
|
||||
|
||||
Continuable<std::unique_ptr<int>&&> MoveTest()
|
||||
{
|
||||
return make_continuable([=](Callback<std::unique_ptr<int>&&>&& callback)
|
||||
{
|
||||
// Move the unique ptr out to test moveability
|
||||
std::unique_ptr<int> ptr(new int(5));
|
||||
callback(std::move(ptr));
|
||||
});
|
||||
}
|
||||
|
||||
void testMoveAbleNormal(std::function<void(std::unique_ptr<int>&&)> callback)
|
||||
{
|
||||
std::unique_ptr<int> ptr(new int(5));
|
||||
callback(std::move(ptr));
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
void test_unwrap(std::string const& msg)
|
||||
{
|
||||
@ -99,6 +115,15 @@ int main(int /*argc*/, char** /*argv*/)
|
||||
return Validate();
|
||||
});
|
||||
|
||||
MoveTest()
|
||||
.then([](std::unique_ptr<int>&& ptr)
|
||||
{
|
||||
static_assert(std::is_rvalue_reference<decltype(ptr)>::value, "no rvalue");
|
||||
|
||||
// Error here
|
||||
std::unique_ptr<int> other = std::move(ptr);
|
||||
});
|
||||
|
||||
// Mockup of aggregate methods
|
||||
make_continuable()
|
||||
.all(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user