AmdisCXXFeatures.cmake 708 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
include(CheckCXXSourceCompiles)

# fold expressions (a + ...)
check_cxx_source_compiles("
  template <class... Args>
  int f(Args... args)
  {
    return (args + ...);
  }
  int main()
  {
    f(0,1,2,3,4,5);
  }
14
"  AMDIS_HAS_CXX_FOLD_EXPRESSIONS
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
)

check_cxx_source_compiles("
  template <int I>
  auto f()
  {
    if constexpr(I == 0)
      return double{1.0};
    else
      return int{0};
  }
  int main()
  {
    return f<1>();
  }
"  AMDIS_HAS_CXX_CONSTEXPR_IF
31
32
33
34
35
36
37
38
39
40
41
42
)

check_cxx_source_compiles("
  #include <iostream>
  #include <tuple>
  int main()
  {
    auto tup = std::make_tuple(0, 'a', 3.14);
    for... (auto elem : tup)
      std::cout << elem << std::endl;
  }
"  AMDIS_HAS_EXPANSION_STATEMENTS
43
)