I have a simple task class:
template<typename TType>
class YHMTask
{
public:
    YHMTask() {};
    template<typename TLambdaFun>
    auto then(TLambdaFun f) -> std::future<decltype(f(mTask.get()))>
    {
        std::move(mTask);
        return std::async(std::launch::async, f, mTask.get());
    }
    std::future<TType> mTask;
private:
};
In this code, .then can be used and return a std::future.
But I want .then to return another YHMTask so that I can call .then after .then. I tried to change .then code to follow:
template<typename TLambdaFun>
auto then(TLambdaFun f) -> YHMTask<decltype(f())>
{
    std::move(mTask);
    std::async(std::launch::async, f, mTask.get());
    YHMTask<decltype(f())> yhmTask(std::move(this));
    return yhmTask;
}
And call .then like this:
auto testTask = YHMCreateTask(PostAsync(L"", L"")).then([=](wstring str)
{
    return 1;
});
Compilier give me this error:
error C2672: 'YHMTask<std::wstring>::then': no matching overloaded function found
error C2893: Failed to specialize function template 'YHMTask<unknown-type> YHMTask<std::wstring>::then(TLambdaFun)'
How should I do?
 
     
    