LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 #include <type_traits>
9 
10 namespace fhicl {
11  namespace detail {
12 
13  template <typename T>
14  std::set<std::string>
16  {
17  static_assert(tt::is_callable<T>::value);
18  return T{}();
19  }
20 
21  inline std::set<std::string>&
22  concatenate_keys(std::set<std::string>& keys)
23  {
24  return keys;
25  }
26 
27  template <typename H, typename... T>
28  std::set<std::string>&
29  concatenate_keys(std::set<std::string>& keys, H const& h, T const&... t)
30  {
31  keys.insert(begin(h), end(h));
32  return concatenate_keys(keys, t...);
33  }
34 
35  } // detail
36 
37  template <typename H, typename... T>
38  struct KeysToIgnore {
39  std::set<std::string>
41  {
42  std::set<std::string> keys_to_ignore{detail::ensure_callable<H>()};
43  return detail::concatenate_keys(keys_to_ignore,
44  detail::ensure_callable<T>()...);
45  }
46  };
47 }
48 
49 #endif /* fhiclcpp_types_KeysToIgnore_h */
50 
51 // Local variables:
52 // mode: c++
53 // End:
std::set< std::string > operator()()
Definition: KeysToIgnore.h:40
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
std::set< std::string > ensure_callable()
Definition: KeysToIgnore.h:15
parameter set interface
std::set< std::string > & concatenate_keys(std::set< std::string > &keys)
Definition: KeysToIgnore.h:22
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69