Interface Documentation
Version: invalid
static_verify.hh
Go to the documentation of this file.
1 /*
2  @@@@@@@@ @@ @@@@@@ @@@@@@@@ @@
3  /@@///// /@@ @@////@@ @@////// /@@
4  /@@ /@@ @@@@@ @@ // /@@ /@@
5  /@@@@@@@ /@@ @@///@@/@@ /@@@@@@@@@/@@
6  /@@//// /@@/@@@@@@@/@@ ////////@@/@@
7  /@@ /@@/@@//// //@@ @@ /@@/@@
8  /@@ @@@//@@@@@@ //@@@@@@ @@@@@@@@ /@@
9  // /// ////// ////// //////// //
10 
11  Copyright (c) 2016, Triad National Security, LLC
12  All rights reserved.
13  */
14 #pragma once
15 
18 #include <tuple>
19 
20 // Description of FLECSI_MEMBER_CHECKER.
21 // The macro invocation FLECSI_MEMBER_CHECKER(foo) produces a class template
22 // has_member_foo<T>, with a static bool data member ::value. The value will
23 // be true if T has a member called foo, or false if T does not.
24 
26 #ifndef FLECSI_MEMBER_CHECKER
27 #define FLECSI_MEMBER_CHECKER(X) \
28  template<typename T> \
29  class has_member_##X \
30  { \
31  struct F { \
32  int X; \
33  }; \
34  struct D : T, F {}; \
35  template<typename C, C> \
36  struct ChT; \
37  template<typename C> \
38  static char (&f(ChT<int F::*, &C::X> *))[1]; \
39  template<typename C> \
40  static char (&f(...))[2]; \
41  \
42  public: /* all outsiders need... */ \
43  static bool const value = sizeof(f<D>(0)) == 2; \
44  }
45 #endif
46 
47 namespace flecsi {
48 namespace util {
49 
51 template<typename T>
52 struct is_tuple {
53  static bool const value = false;
54 };
55 
57 template<typename... T>
58 struct is_tuple<std::tuple<T...>> {
59  static bool const value = true;
60 };
61 
62 } // namespace util
63 } // namespace flecsi
Check if the object is a tuple.
Definition: static_verify.hh:52
Definition: control.hh:31