0

Here is the code preview in vs 2019

GGBOI250
  • 23
  • 1
  • 4

2 Answers2

1

std::any and std::any_cast were added in c++17, please make sure that you are compiling with the correct version.

Max Drießen
  • 109
  • 5
0

I had to add an include to <any> to get my program to compile. My includes look like this:

#include <iostream>
#include <any>

I also was able to confirm I was using the c++ 17 compiler by doing this:

   std::cout << __cplusplus << std::endl;
    /*
see this on SO <https://stackoverflow.com/questions/2324658/how-to-determine-the-version-of-the-c-standard-used-by-the-compiler>
C++ pre-C++98: __cplusplus is 1.
C++98: __cplusplus is 199711L.
C++98 + TR1: This reads as C++98 and there is no way to check that I know of.
C++11: __cplusplus is 201103L.
C++14: __cplusplus is 201402L.
C++17: __cplusplus is 201703L.
C++20: __cplusplus is 202002L.
    */
Ken_sf
  • 89
  • 1
  • 9