KeysToIgnore.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_types_KeysToIgnore_h
2 #define fhiclcpp_types_KeysToIgnore_h
3 
4 #include "fhiclcpp/type_traits.h"
5 
6 #include <set>
7 #include <string>
8 
9 #define TEMPLATE_ARG "Template argument specified must be callable."
10 
11 namespace fhicl {
12  namespace detail {
13 
14  template <typename T>
15  std::set<std::string>
17  {
19  return T{}();
20  }
21 
22  inline std::set<std::string>&
23  concatenate_keys(std::set<std::string>& keys)
24  {
25  return keys;
26  }
27 
28  template <typename H, typename... T>
29  std::set<std::string>&
30  concatenate_keys(std::set<std::string>& keys, H const& h, T const&... t)
31  {
32  keys.insert(begin(h), end(h));
33  return concatenate_keys(keys, t...);
34  }
35 
36  } // detail
37 
38  template <typename H, typename... T>
39  struct KeysToIgnore {
40  std::set<std::string>
42  {
43  std::set<std::string> keys_to_ignore{detail::ensure_callable<H>()};
44  return detail::concatenate_keys(keys_to_ignore,
45  detail::ensure_callable<T>()...);
46  }
47  };
48 }
49 
50 #undef TEMPLATE_ARG
51 #endif /* fhiclcpp_types_KeysToIgnore_h */
52 
53 // Local variables:
54 // mode: c++
55 // End:
std::set< std::string > operator()()
Definition: KeysToIgnore.h:41
std::set< std::string > ensure_callable()
Definition: KeysToIgnore.h:16
std::set< std::string > & concatenate_keys(std::set< std::string > &keys)
Definition: KeysToIgnore.h:23
#define TEMPLATE_ARG
Definition: KeysToIgnore.h:9
double T
Definition: Xdiff_gwt.C:5