Main MRPT website > C++ reference for MRPT 1.9.9
ci_less.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <functional> // binary_function
12 #include <cctype> // tolower
13 #include <string>
14 
15 namespace mrpt
16 {
17 namespace utils
18 {
19 /** \addtogroup stlext_grp STL extensions and metaprogramming
20  * \ingroup mrpt_base_grp
21  * @{ */
22 
23 /** A case-insensitive comparator struct for usage within STL containers, eg:
24  * map<string,string,ci_less>
25  * \note Defined in #include <mrpt/utils/ci_less.h>
26  */
27 struct ci_less : std::binary_function<std::string, std::string, bool>
28 {
29  // case-independent (ci) compare_less binary function
30  struct nocase_compare : public std::binary_function<char, char, bool>
31  {
32  bool operator()(const char c1, const char c2) const
33  {
34  return tolower(c1) < tolower(c2);
35  }
36  };
37  bool operator()(const std::string& s1, const std::string& s2) const
38  {
39  return std::lexicographical_compare(
40  s1.begin(), s1.end(), s2.begin(), s2.end(), nocase_compare());
41  }
42 }; // end of ci_less
43 
44 /** @} */ // end of grouping
45 } // End of namespace
46 } // End of namespace
bool operator()(const char c1, const char c2) const
Definition: ci_less.h:32
A case-insensitive comparator struct for usage within STL containers, eg: map<string,string,ci_less>
Definition: ci_less.h:27
GLsizei const GLchar ** string
Definition: glext.h:4101
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool operator()(const std::string &s1, const std::string &s2) const
Definition: ci_less.h:37



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019