dimanche 20 juin 2021

Why does 'std::function

#include <functional>

void f()
{
    // warning: return-statement with a value, in function returning 'void'
    return true; 
}

std::function<void()> fn = [] { return true; }; // no warning

int main()
{}

Why does std::function<void()> take a lambda returning bool without any warning?

Aucun commentaire:

Enregistrer un commentaire