Rivet  3.1.0
Utils.hh
1 // -*- C++ -*-
2 #ifndef RIVET_Utils_HH
3 #define RIVET_Utils_HH
4 
5 #include "Rivet/Tools/RivetSTL.hh"
6 #include "Rivet/Tools/PrettyPrint.hh"
7 #include "Rivet/Tools/Exceptions.hh"
8 #include <ostream>
9 #include <cctype>
10 #include <cerrno>
11 #include <stdexcept>
12 #include <numeric>
13 #include <limits>
14 #include <climits>
15 #include <cfloat>
16 #include <cmath>
17 #include <sstream>
18 #include <functional>
19 
21 
22 
24 #ifndef DEPRECATED
25 #if __GNUC__ && __cplusplus && RIVET_NO_DEPRECATION_WARNINGS == 0
26 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
27 #if GCC_VERSION >= 40500
28  #if __cplusplus > 201103L
29  #define DEPRECATED(x) [[deprecated(x)]]
30  #else
31  #define DEPRECATED(x) __attribute__((deprecated(x)))
32  #endif
33 #else
34  #define DEPRECATED(x) __attribute__((deprecated))
35 #endif
36 #else
37  #define DEPRECATED(x)
38 #endif
39 #endif
40 
41 
42 namespace Rivet {
43 
44 
46  static constexpr double DBL_NAN = std::numeric_limits<double>::quiet_NaN();
47 
48 
51 
53  struct bad_lexical_cast : public std::runtime_error {
54  bad_lexical_cast(const std::string& what) : std::runtime_error(what) {}
55  };
56 
58  template<typename T, typename U>
59  T lexical_cast(const U& in) {
60  try {
61  std::stringstream ss;
62  ss << in;
63  T out;
64  ss >> out;
65  return out;
66  } catch (const std::exception& e) {
67  throw bad_lexical_cast(e.what());
68  }
69  }
70 
74  template <typename T>
75  inline string to_str(const T& x) {
76  return to_string(x);
77  }
78 
82  template <typename T>
83  inline string toString(const T& x) {
84  return to_string(x);
85  }
86 
88  inline string& replace_first(string& str, const string& patt, const string& repl) {
89  if (!contains(str, patt)) return str; //< contains from RivetSTL
90  str.replace(str.find(patt), patt.size(), repl);
91  return str;
92  }
93 
99  inline string& replace_all(string& str, const string& patt, const string& repl) {
100  if (!contains(str, patt)) return str; //< contains from RivetSTL
101  while (true) {
102  string::size_type it = str.find(patt);
103  if (it == string::npos) break;
104  str.replace(it, patt.size(), repl);
105  }
106  return str;
107  }
108 
109 
111  inline int nocase_cmp(const string& s1, const string& s2) {
112  string::const_iterator it1 = s1.begin();
113  string::const_iterator it2 = s2.begin();
114  while ( (it1 != s1.end()) && (it2 != s2.end()) ) {
115  if(::toupper(*it1) != ::toupper(*it2)) { // < Letters differ?
116  // Return -1 to indicate smaller than, 1 otherwise
117  return (::toupper(*it1) < ::toupper(*it2)) ? -1 : 1;
118  }
119  // Proceed to the next character in each string
120  ++it1;
121  ++it2;
122  }
123  size_t size1 = s1.size(), size2 = s2.size(); // Cache lengths
124  // Return -1,0 or 1 according to strings' lengths
125  if (size1 == size2) return 0;
126  return (size1 < size2) ? -1 : 1;
127  }
128 
129 
131  inline bool nocase_equals(const string& s1, const string& s2) {
132  return nocase_cmp(s1, s2) == 0;
133  }
134 
135 
137  inline string toLower(const string& s) {
138  string out = s;
139  std::transform(out.begin(), out.end(), out.begin(), (int(*)(int)) std::tolower);
140  return out;
141  }
142 
143 
145  inline string toUpper(const string& s) {
146  string out = s;
147  std::transform(out.begin(), out.end(), out.begin(), (int(*)(int)) std::toupper);
148  return out;
149  }
150 
151 
153  inline bool startsWith(const string& s, const string& start) {
154  if (s.length() < start.length()) return false;
155  return s.substr(0, start.length()) == start;
156  }
157 
158 
160  inline bool endsWith(const string& s, const string& end) {
161  if (s.length() < end.length()) return false;
162  return s.substr(s.length() - end.length()) == end;
163  }
164 
165 
167  template <typename T>
168  inline string join(const vector<T>& v, const string& sep=" ") {
169  string rtn;
170  for (size_t i = 0; i < v.size(); ++i) {
171  if (i != 0) rtn += sep;
172  rtn += to_str(v[i]);
173  }
174  return rtn;
175  }
176 
178  template <>
179  inline string join(const vector<string>& v, const string& sep) {
180  string rtn;
181  for (size_t i = 0; i < v.size(); ++i) {
182  if (i != 0) rtn += sep;
183  rtn += v[i];
184  }
185  return rtn;
186  }
187 
189  template <typename T>
190  inline string join(const set<T>& s, const string& sep=" ") {
191  string rtn;
192  for (const T& x : s) {
193  if (rtn.size() > 0) rtn += sep;
194  rtn += to_str(x);
195  }
196  return rtn;
197  }
198 
200  template <>
201  inline string join(const set<string>& s, const string& sep) {
202  string rtn;
203  for (const string & x : s) {
204  if (rtn.size() > 0) rtn += sep;
205  rtn += x;
206  }
207  return rtn;
208  }
209 
211  inline vector<string> split(const string& s, const string& sep) {
212  vector<string> dirs;
213  string tmp = s;
214  while (true) {
215  const size_t delim_pos = tmp.find(sep);
216  if (delim_pos == string::npos) break;
217  const string dir = tmp.substr(0, delim_pos);
218  if (dir.length()) dirs.push_back(dir); // Don't insert "empties"
219  tmp.replace(0, delim_pos+1, "");
220  }
221  if (tmp.length()) dirs.push_back(tmp); // Don't forget the trailing component!
222  return dirs;
223  }
224 
226 
227 
228 
231 
235  inline vector<string> pathsplit(const string& path) {
236  return split(path, ":");
237  }
238 
243  inline string pathjoin(const vector<string>& paths) {
244  return join(paths, ":");
245  }
246 
248  inline string operator / (const string& a, const string& b) {
249  // Ensure that a doesn't end with a slash, and b doesn't start with one, to avoid "//"
250  const string anorm = (a.find("/") != string::npos) ? a.substr(0, a.find_last_not_of("/")+1) : a;
251  const string bnorm = (b.find("/") != string::npos) ? b.substr(b.find_first_not_of("/")) : b;
252  return anorm + "/" + bnorm;
253  }
254 
256  inline string basename(const string& p) {
257  if (!contains(p, "/")) return p;
258  return p.substr(p.rfind("/")+1);
259  }
260 
262  inline string dirname(const string& p) {
263  if (!contains(p, "/")) return "";
264  return p.substr(0, p.rfind("/"));
265  }
266 
268  inline string file_stem(const string& f) {
269  if (!contains(f, ".")) return f;
270  return f.substr(0, f.rfind("."));
271  }
272 
274  inline string file_extn(const string& f) {
275  if (!contains(f, ".")) return "";
276  return f.substr(f.rfind(".")+1);
277  }
278 
280 
281 
282 
285 
287  template <typename CONTAINER>
288  inline unsigned int count(const CONTAINER& c) {
289  // return std::count_if(std::begin(c), std::end(c), [](const typename CONTAINER::value_type& x){return bool(x);});
290  unsigned int rtn = 0;
291  for (const auto& x : c) if (bool(x)) rtn += 1;
292  return rtn;
293  }
294 
295  // /// Return number of elements in the container @a c for which @c f(x) is true.
296  // template <typename CONTAINER>
297  // inline unsigned int count(const CONTAINER& c, const std::function<bool(typename CONTAINER::value_type)>& f) {
298  // return std::count_if(std::begin(c), std::end(c), f);
299  // }
300 
302  template <typename CONTAINER, typename FN>
303  inline unsigned int count(const CONTAINER& c, const FN& f) {
304  return std::count_if(std::begin(c), std::end(c), f);
305  }
306 
307 
308 
310  template <typename CONTAINER>
311  inline bool any(const CONTAINER& c) {
312  // return std::any_of(std::begin(c), std::end(c), [](const auto& x){return bool(x);});
313  for (const auto& x : c) if (bool(x)) return true;
314  return false;
315  }
316 
317  // /// Return true if f(x) is true for any x in container c, otherwise false.
318  // template <typename CONTAINER>
319  // inline bool any(const CONTAINER& c, const std::function<bool(typename CONTAINER::value_type)>& f) {
320  // return std::any_of(std::begin(c), std::end(c), f);
321  // }
322 
324  template <typename CONTAINER, typename FN>
325  inline bool any(const CONTAINER& c, const FN& f) {
326  return std::any_of(std::begin(c), std::end(c), f);
327  }
328 
329 
330 
332  template <typename CONTAINER>
333  inline bool all(const CONTAINER& c) {
334  // return std::all_of(std::begin(c), std::end(c), [](const auto& x){return bool(x);});
335  for (const auto& x : c) if (!bool(x)) return false;
336  return true;
337  }
338 
339  // /// Return true if @a f(x) is true for all @c x in container @a c, otherwise false.
340  // template <typename CONTAINER>
341  // inline bool all(const CONTAINER& c, const std::function<bool(typename CONTAINER::value_type)>& f) {
342  // return std::all_of(std::begin(c), std::end(c), f);
343  // }
344 
346  template <typename CONTAINER, typename FN>
347  inline bool all(const CONTAINER& c, const FN& f) {
348  return std::all_of(std::begin(c), std::end(c), f);
349  }
350 
351 
352 
354  template <typename CONTAINER>
355  inline bool none(const CONTAINER& c) {
356  // return std::none_of(std::begin(c), std::end(c), [](){});
357  for (const auto& x : c) if (bool(x)) return false;
358  return true;
359  }
360 
361  // /// Return true if @a f(x) is false for all @c x in container @a c, otherwise false.
362  // template <typename C>
363  // inline bool none(const C& c, const std::function<bool(typename C::value_type)>& f) {
364  // return std::none_of(std::begin(c), std::end(c), f);
365  // }
366 
368  template <typename CONTAINER, typename FN>
369  inline bool none(const CONTAINER& c, const FN& f) {
370  return std::none_of(std::begin(c), std::end(c), f);
371  }
372 
373 
374  // /// A single-container-arg version of std::transform, aka @c map
375  // template <typename CONTAINER1, typename CONTAINER2>
376  // inline const CONTAINER2& transform(const CONTAINER1& in, CONTAINER2& out,
377  // const std::function<typename CONTAINER2::value_type(typename CONTAINER1::value_type)>& f) {
378  // out.clear(); out.resize(in.size());
379  // std::transform(in.begin(), in.end(), out.begin(), f);
380  // return out;
381  // }
382 
384  template <typename CONTAINER1, typename CONTAINER2, typename FN>
385  inline const CONTAINER2& transform(const CONTAINER1& in, CONTAINER2& out, const FN& f) {
386  out.clear(); out.resize(in.size());
387  std::transform(in.begin(), in.end(), out.begin(), f);
388  return out;
389  }
390 
393  template <typename CONTAINER1, typename T2>
394  inline std::vector<T2> transform(const CONTAINER1& in, const std::function<T2(typename CONTAINER1::value_type)>& f) {
395  std::vector<T2> out(in.size());
396  transform(in, out, f);
397  return out;
398  }
399 
400 
401 
402  // /// A single-container-arg version of std::accumulate, aka @c reduce
403  // template <typename CONTAINER1, typename T>
404  // inline T accumulate(const CONTAINER1& in, const T& init, const std::function<T(typename CONTAINER1::value_type)>& f) {
405  // const T rtn = std::accumulate(in.begin(), in.end(), init, f);
406  // return rtn;
407  // }
408 
410  template <typename CONTAINER1, typename T, typename FN>
411  inline T accumulate(const CONTAINER1& in, const T& init, const FN& f) {
412  const T rtn = std::accumulate(in.begin(), in.end(), init, f);
413  return rtn;
414  }
415 
416 
417 
421  template <typename CONTAINER>
422  inline typename CONTAINER::value_type sum(const CONTAINER& c) {
423  typename CONTAINER::value_type rtn; //< default construct return type
424  for (const auto& x : c) rtn += x;
425  return rtn;
426  }
427 
431  template <typename CONTAINER, typename T>
432  inline T sum(const CONTAINER& c, const T& start) {
433  T rtn = start;
434  for (const auto& x : c) rtn += x;
435  return rtn;
436  }
437 
439  template <typename CONTAINER, typename FN, typename T>
440  inline T sum(const CONTAINER& c, const FN& f, const T& start=T()) {
441  T rtn = start;
442  for (const auto& x : c) rtn += f(x);
443  return rtn;
444  }
445 
446 
447 
451  template <typename CONTAINER, typename T>
452  inline T& isum(const CONTAINER& c, T& out) {
453  for (const auto& x : c) out += x;
454  return out;
455  }
456 
460  template <typename CONTAINER, typename FN, typename T>
461  inline T& isum(const CONTAINER& c, const FN& f, T& out) {
462  for (const auto& x : c) out += f(x);
463  return out;
464  }
465 
466 
467 
470  template <typename CONTAINER, typename FN>
471  inline CONTAINER& ifilter_discard(CONTAINER& c, const FN& f) {
472  const auto newend = std::remove_if(std::begin(c), std::end(c), f);
473  c.erase(newend, c.end());
474  return c;
475  }
477  template <typename CONTAINER, typename FN>
478  inline CONTAINER& idiscard(CONTAINER& c, const FN& f) {
479  return ifilter_discard(c, f);
480  }
481 
482 
485  template <typename CONTAINER, typename FN>
486  inline CONTAINER filter_discard(const CONTAINER& c, const FN& f) {
487  CONTAINER rtn = c;
488  return ifilter_discard(rtn, f);
489  }
491  template <typename CONTAINER, typename FN>
492  inline CONTAINER& discard(CONTAINER& c, const FN& f) {
493  return filter_discard(c, f);
494  }
495 
499  template <typename CONTAINER, typename FN>
500  inline CONTAINER& filter_discard(const CONTAINER& c, const FN& f, CONTAINER& out) {
501  out = filter_discard(c, f);
502  return out;
503  }
505  template <typename CONTAINER, typename FN>
506  inline CONTAINER& discard(CONTAINER& c, const FN& f, CONTAINER& out) {
507  return filter_discard(c, f, out);
508  }
509 
510 
511 
514  template <typename CONTAINER, typename FN>
515  inline CONTAINER& ifilter_select(CONTAINER& c, const FN& f) {
516  //using value_type = typename std::remove_reference<decltype(*std::begin(std::declval<typename std::add_lvalue_reference<CONTAINER>::type>()))>::type;
517  auto invf = [&](const typename CONTAINER::value_type& x){ return !f(x); };
518  return ifilter_discard(c, invf);
519  }
521  template <typename CONTAINER, typename FN>
522  inline CONTAINER& iselect(CONTAINER& c, const FN& f) {
523  return ifilter_select(c, f);
524  }
525 
528  template <typename CONTAINER, typename FN>
529  inline CONTAINER filter_select(const CONTAINER& c, const FN& f) {
530  CONTAINER rtn = c;
531  return ifilter_select(rtn, f);
532  }
534  template <typename CONTAINER, typename FN>
535  inline CONTAINER select(const CONTAINER& c, const FN& f) {
536  return filter_select(c, f);
537  }
538 
542  template <typename CONTAINER, typename FN>
543  inline CONTAINER& filter_select(const CONTAINER& c, const FN& f, CONTAINER& out) {
544  out = filter_select(c, f);
545  return out;
546  }
548  template <typename CONTAINER, typename FN>
549  inline CONTAINER& select(CONTAINER& c, const FN& f, CONTAINER& out) {
550  return filter_select(c, f, out);
551  }
552 
553 
554 
559  template <typename CONTAINER>
560  inline CONTAINER slice(const CONTAINER& c, int i, int j) {
561  CONTAINER rtn;
562  const size_t off1 = (i >= 0) ? i : c.size() + i;
563  const size_t off2 = (j >= 0) ? j : c.size() + j;
564  if (off1 > c.size() || off2 > c.size()) throw RangeError("Attempting to slice beyond requested offsets");
565  if (off2 < off1) throw RangeError("Requested offsets in invalid order");
566  rtn.resize(off2 - off1);
567  std::copy(c.begin()+off1, c.begin()+off2, rtn.begin());
568  return rtn;
569  }
570 
574  template <typename CONTAINER>
575  inline CONTAINER slice(const CONTAINER& c, int i) {
576  return slice(c, i, c.size());
577  }
578 
582  template <typename CONTAINER>
583  inline CONTAINER head(const CONTAINER& c, int n) {
584  // if (n > c.size()) throw RangeError("Requested head longer than container");
585  if (n < 0) n = std::max(0, (int)c.size()+n);
586  n = std::min(n, (int)c.size());
587  return slice(c, 0, n);
588  }
589 
593  template <typename CONTAINER>
594  inline CONTAINER tail(const CONTAINER& c, int n) {
595  // if (n > c.size()) throw RangeError("Requested tail longer than container");
596  if (n < 0) n = std::max(0, (int)c.size()+n);
597  n = std::min(n, (int)c.size());
598  return slice(c, c.size()-n);
599  }
600 
601 
602  using std::min;
603  using std::max;
604 
606  inline double min(const vector<double>& in, double errval=DBL_NAN) {
607  const auto e = std::min_element(in.begin(), in.end());
608  return e != in.end() ? *e : errval;
609  }
610 
612  inline double max(const vector<double>& in, double errval=DBL_NAN) {
613  const auto e = std::max_element(in.begin(), in.end());
614  return e != in.end() ? *e : errval;
615  }
616 
618  inline pair<double,double> minmax(const vector<double>& in, double errval=DBL_NAN) {
619  const auto e = std::minmax_element(in.begin(), in.end());
620  const double rtnmin = e.first != in.end() ? *e.first : errval;
621  const double rtnmax = e.second != in.end() ? *e.first : errval;
622  return std::make_pair(rtnmin, rtnmax);
623  }
624 
625 
627  inline int min(const vector<int>& in, int errval=-1) {
628  const auto e = std::min_element(in.begin(), in.end());
629  return e != in.end() ? *e : errval;
630  }
631 
633  inline int max(const vector<int>& in, int errval=-1) {
634  const auto e = std::max_element(in.begin(), in.end());
635  return e != in.end() ? *e : errval;
636  }
637 
639  inline pair<int,int> minmax(const vector<int>& in, int errval=-1) {
640  const auto e = std::minmax_element(in.begin(), in.end());
641  const double rtnmin = e.first != in.end() ? *e.first : errval;
642  const double rtnmax = e.second != in.end() ? *e.first : errval;
643  return std::make_pair(rtnmin, rtnmax);
644  }
645 
647 
648 
654  template <typename T>
655  T getEnvParam(const std::string name, const T& fallback) {
656  char* env = getenv(name.c_str());
657  return env ? lexical_cast<T>(env) : fallback;
658  }
659 
660 
661 }
662 
663 #endif
T lexical_cast(const U &in)
Convert between any types via stringstream.
Definition: Utils.hh:59
Definition: MC_Cent_pPb.hh:10
bool any(const CONTAINER &c)
Return true if x is true for any x in container c, otherwise false.
Definition: Utils.hh:311
T getEnvParam(const std::string name, const T &fallback)
Get a parameter from a named environment variable, with automatic type conversion.
Definition: Utils.hh:655
CONTAINER head(const CONTAINER &c, int n)
Head slice of the n first container elements.
Definition: Utils.hh:583
string dirname(const string &p)
Get the dirname (i.e. path to the penultimate directory) from a path p.
Definition: Utils.hh:262
unsigned int count(const CONTAINER &c)
Return number of true elements in the container c .
Definition: Utils.hh:288
Jets filter_select(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
Definition: JetUtils.hh:160
T & isum(const CONTAINER &c, T &out)
Definition: Utils.hh:452
Exception class for throwing from lexical_cast when a parse goes wrong.
Definition: Utils.hh:53
static constexpr double DBL_NAN
Convenient const for getting the double NaN value.
Definition: Utils.hh:46
string & replace_all(string &str, const string &patt, const string &repl)
Replace all instances of patt with repl.
Definition: Utils.hh:99
bool endsWith(const string &s, const string &end)
Check whether a string end is found at the end of s.
Definition: Utils.hh:160
string basename(const string &p)
Get the basename (i.e. terminal file name) from a path p.
Definition: Utils.hh:256
bool startsWith(const string &s, const string &start)
Check whether a string start is found at the start of s.
Definition: Utils.hh:153
bool none(const CONTAINER &c)
Return true if x is false for all x in container c, otherwise false.
Definition: Utils.hh:355
string & replace_first(string &str, const string &patt, const string &repl)
Replace the first instance of patt with repl.
Definition: Utils.hh:88
int nocase_cmp(const string &s1, const string &s2)
Case-insensitive string comparison function.
Definition: Utils.hh:111
string toLower(const string &s)
Convert a string to lower-case.
Definition: Utils.hh:137
CONTAINER tail(const CONTAINER &c, int n)
Tail slice of the n last container elements.
Definition: Utils.hh:594
string to_str(const T &x)
Convert any object to a string.
Definition: Utils.hh:75
pair< double, double > minmax(const vector< double > &in, double errval=DBL_NAN)
Find the minimum and maximum values in the vector.
Definition: Utils.hh:618
T accumulate(const CONTAINER1 &in, const T &init, const FN &f)
A single-container-arg version of std::accumulate, aka reduce.
Definition: Utils.hh:411
Jets filter_discard(const Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that fails the supplied Cut.
Definition: JetUtils.hh:191
string file_stem(const string &f)
Get the stem (i.e. part without a file extension) from a filename f.
Definition: Utils.hh:268
int min(const vector< int > &in, int errval=-1)
Find the minimum value in the vector.
Definition: Utils.hh:627
int max(const vector< int > &in, int errval=-1)
Find the maximum value in the vector.
Definition: Utils.hh:633
Jets discard(const Jets &jets, const Cut &c)
New alias for filter_discard.
Definition: JetUtils.hh:196
CONTAINER::value_type sum(const CONTAINER &c)
Generic sum function, adding x for all x in container c.
Definition: Utils.hh:422
Jets select(const Jets &jets, const Cut &c)
New alias for filter_select.
Definition: JetUtils.hh:168
vector< string > split(const string &s, const string &sep)
Split a string on a specified separator string.
Definition: Utils.hh:211
std::vector< T2 > transform(const CONTAINER1 &in, const std::function< T2(typename CONTAINER1::value_type)> &f)
Definition: Utils.hh:394
string file_extn(const string &f)
Get the file extension from a filename f.
Definition: Utils.hh:274
bool contains(const std::string &s, const std::string &sub)
Does s contain sub as a substring?
Definition: RivetSTL.hh:93
double max(const vector< double > &in, double errval=DBL_NAN)
Find the maximum value in the vector.
Definition: Utils.hh:612
string join(const vector< T > &v, const string &sep=" ")
Make a string containing the string representations of each item in v, separated by sep...
Definition: Utils.hh:168
std::string toString(const AnalysisInfo &ai)
String representation.
Jets & ifilter_select(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that passes the supplied Cut.
CONTAINER slice(const CONTAINER &c, int i, int j)
Slice of the container elements cf. Python&#39;s [i:j] syntax.
Definition: Utils.hh:560
string toUpper(const string &s)
Convert a string to upper-case.
Definition: Utils.hh:145
Jets & iselect(Jets &jets, const Cut &c)
New alias for ifilter_select.
Definition: JetUtils.hh:156
bool all(const CONTAINER &c)
Return true if x is true for all x in container c, otherwise false.
Definition: Utils.hh:333
vector< string > pathsplit(const string &path)
Split a path string with colon delimiters.
Definition: Utils.hh:235
string pathjoin(const vector< string > &paths)
Join several filesystem paths together with the standard &#39;:&#39; delimiter.
Definition: Utils.hh:243
Jets & ifilter_discard(Jets &jets, const Cut &c)
Filter a jet collection in-place to the subset that fails the supplied Cut.
Jets & idiscard(Jets &jets, const Cut &c)
New alias for ifilter_discard.
Definition: JetUtils.hh:187
double min(const vector< double > &in, double errval=DBL_NAN)
Find the minimum value in the vector.
Definition: Utils.hh:606
Error for e.g. use of invalid bin ranges.
Definition: Exceptions.hh:22
bool nocase_equals(const string &s1, const string &s2)
Case-insensitive string equality function.
Definition: Utils.hh:131