lundi 6 avril 2020

C++ Auto Executing Function?

While solving Leetcode Problems I have encountered a problem solution (where generally we get access to only the solution class, not the main) where I have found this statement after class declaration & definition. I am acquainted with the inside content like cin.tie sync_with_stdio etc. But what is the auto speedup with [](){//}() is doing. Is it a self-executing function. Any help will be highly appreciated.

   auto speedup=[](){
        std::ios::sync_with_stdio(false);
        cin.tie(nullptr);
        cout.tie(nullptr);
        return nullptr;
    }();

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire