TestStdAny.cpp 456 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
#include <iostream>
#if defined(WALBERLA_USE_STD_ANY)
#include <any>
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
#include <experimental/any>
#endif

int main() {
#if defined(WALBERLA_USE_STD_ANY)
   auto a = std::any(42);
11
   std::cout << std::any_cast<int>(a) << std::endl;
12 13 14
#elif defined(WALBERLA_USE_STD_EXPERIMENTAL_ANY)
   auto a = std::experimental::any(42);
   std::cout << std::experimental::any_cast<int>(a) << std::endl;
15
#endif
16 17
   return 0;
}