20 LimitedWarning(std::string message, std::string source) :
msg{std::move(message)},
src{std::move(source)} {}
24 static bool unused = [
this] {
28 logger->warn(
"{}",
msg);
29 if (++count < times_to_run - 1) {
32 if (count == times_to_run - 1) {
33 logger->warn(
"{} (This warning will not be printed anymore)",
msg);
51 template <
typename T,
typename Key,
typename Value>
52 typename std::enable_if<std::is_convertible<T, Key>::value,
bool>::type
53 KeyExists(T key,
const std::map<Key, Value> &container) {
55 return container.find(static_cast<Key>(key)) !=
end(container);
59 template <
typename T,
typename Value>
60 typename std::enable_if<std::is_convertible<T, size_t>::value,
bool>::type
61 KeyExists(T key,
const std::vector<Value> &container) {
63 return container.size() >
static_cast<size_t>(key);
67 template <
typename T,
typename Key,
typename Value>
68 typename std::enable_if<std::is_convertible<T, Key>::value,
bool>::type
70 return container.find(static_cast<Key>(key)) !=
end(container);
74 template <
typename T,
typename Key>
75 typename std::enable_if<std::is_convertible<Key, size_t>::value,
bool>::type
77 return container.size() >
static_cast<size_t>(key);
81 template <
typename T,
typename Key,
typename... Keys,
typename Value>
82 typename std::enable_if<std::is_convertible<T, Key>::value,
bool>::type
83 ContainsKeys(
const std::map<Key, Value> &container, T key, Keys... keys) {
84 if (container.find(static_cast<Key>(key)) !=
end(container)) {
92 template <
typename T,
typename Key,
typename... Keys>
93 typename std::enable_if<std::is_convertible<Key, size_t>::value,
bool>::type
94 ContainsKeys(
const std::vector<T> &container, Key key, Keys... keys) {
95 if (container.size() >
static_cast<size_t>(key))
LimitedWarning(std::string message, std::string source)
const LimitedWarning< 10 > keyexists_deprecation_msg
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)
std::enable_if< std::is_convertible< T, Key >::value, bool >::type ContainsKeys(const std::map< Key, Value > &container, T key)
auto getLogger(const std::string &fnName)
Create a new logger with a given function name.