Do all C++ compilers support the async/await keywords?

前端 未结 1 2000
没有蜡笔的小新
没有蜡笔的小新 2021-02-13 14:17

I want to use async/await syntax in C++ (UE4 framework), but due to cross-platform code I not sure that is possible... Or possible? If yes, how can I use it?

<
1条回答
  •  时光说笑
    2021-02-13 15:19

    async and await are language extensions proposed by Microsoft with several revisions, but current is N4134. This has not yet accepted into the standard.

    The proposal is opposed by many like http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0158r0.html due to not being completely baked and having not been explored fully in a TS and there's competing proposals like N3985 which proposes coroutines that can be implemented within the existing language standard.

    To my knowledge, the only compiler that actually supports async/await is MS Visual Studio.

    As an update, clang 5.0 has support for the current draft co-routines proposal https://isocpp.org/files/papers/N4663.pdf which has now been accepted as a TS and is progressing with an eye toward the C++20 standard.

    0 讨论(0)
提交回复
热议问题