dimanche 26 mars 2017

Does std::call_once work under VS2013 and below?

I am trying to determine if std::call_once works as expected under Visual Studio 2013 and below when C++11 is in effect. An example is shown below.

// C++ source file

std::once_flag flag;
int main()
{
    std::call_once(flag, []() {
        // ...
    });
}

Microsoft's Support For C++11/14/17 Features does not appear to discuss std::call_once. I am not sure if it depends upon Dynamic Initialization and Destruction with Concurrency or not. Though its a core language feature, Microsoft did not provide it until VS2015.

My question is, will std::call_once work under most versions of Windows (XP and above) and most versions of Visual Studio with C++11 support (VS 2010 and above)? If not, then what are the requirements to use it?

Aucun commentaire:

Enregistrer un commentaire