How to deal with noexcept in Visual Studio

前端 未结 11 1707
一整个雨季
一整个雨季 2021-01-31 07:42

I\'m trying to create a custom exception that derives from std::exception and overrides what(). At first, I wrote it like this:

class U         


        
11条回答
  •  礼貌的吻别
    2021-01-31 08:17

    #IFs may work, even if a bit hacky.

    You could just do this:

    #if __GNUG__
    virtual const char* what() const noexcept override
    #else
    virtual const char* what() const override
    #endif
    //method body
    

提交回复
热议问题