NAIA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Utils.hpp
Go to the documentation of this file.
1 #ifndef NAIA_UTILS_HPP
2 #define NAIA_UTILS_HPP
3 
4 #include <map>
5 #include <vector>
6 
7 namespace NAIA {
9 template <typename T, typename Key, typename Value>
10 typename std::enable_if<std::is_convertible<T, Key>::value, bool>::type
11 KeyExists(T key, const std::map<Key, Value> &container) {
12  return !(container.find(static_cast<Key>(key)) == end(container));
13 }
14 
16 template <typename T, typename Value>
17 typename std::enable_if<std::is_convertible<T, size_t>::value, bool>::type
18 KeyExists(T key, const std::vector<Value> &container) {
19  return container.size() > static_cast<size_t>(key);
20 }
21 
22 } // namespace NAIA
23 #endif
SingleTreeChain::EventItr end(SingleTreeChain &chain)
std::enable_if< std::is_convertible< T, Key >::value, bool >::type KeyExists(T key, const std::map< Key, Value > &container)
Definition: Utils.hpp:11