jeudi 20 avril 2023

Understanding Async function in c++

I am relatively new to c++ programming. I am trying to understand the meaning of this header in std::async library

template< class Function, class... Args >
std::future<typename std::result_of<typename std::decay<Function>::type(
        typename std::decay<Args>::type...)>::type>
    async( Function&& f, Args&&... args );```



Can someone breakdown and explain the return types of this please? 

    `std::future<typename std::result_of<typename std::decay<Function>::type(
            typename std::decay<Args>::type...)>::type>`

    std::future<std::invoke_result_t<std::decay_t<Function>,
                                     std::decay_t<Args>...>>

    [[nodiscard]] std::future<std::invoke_result_t<std::decay_t<Function>,
                                                   std::decay_t<Args>...>>

Aucun commentaire:

Enregistrer un commentaire