cpp.sh找不到任何

时间:2018-06-30 23:05:09

标签: c++

我正在使用C++ Shell在线进行编译。

在我的一个程序中,我必须使用std::any。我不知道std::any的其他替代方法,因此我决定使用它。

C ++ Shell似乎找不到any.hstd::any。我该怎么办?

代码:

#include <any>

    // Class creation, functions etc...

    void CallIfFunction(std::any variable) {
        (void)variable;
    }

1 个答案:

答案 0 :(得分:1)

CPP.sh 不支持C ++ 17(唯一可用的选项是98、11、14)。尝试使用以下代码进行编译:

#if __cplusplus == 201703L
    #warning this is C++17
#else
    #error this is NOT C++17
#endif

您会收到此错误:

  

4:2:错误:#error this is NOT C++17

std::any是C ++ 17的一项功能,仅在您的编译器符合C ++ 17的情况下可用。