Main MRPT website > C++ reference for MRPT 1.5.7
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: map<string,string,ci_less>
24  * \note Defined in #include <mrpt/utils/ci_less.h>
25  */
26  struct ci_less : std::binary_function<std::string,std::string,bool>
27  {
28  // case-independent (ci) compare_less binary function
29  struct nocase_compare : public std::binary_function<char,char,bool> {
30  bool operator()(const char c1, const char c2) const { return tolower(c1)<tolower(c2); }
31  };
32  bool operator() (const std::string & s1, const std::string & s2) const {
33  return std::lexicographical_compare(s1.begin(),s1.end(), s2.begin(),s2.end(), nocase_compare());
34  }
35  }; // end of ci_less
36 
37  /** @} */ // end of grouping
38  } // End of namespace
39 } // End of namespace
bool operator()(const char c1, const char c2) const
Definition: ci_less.h:30
A case-insensitive comparator struct for usage within STL containers, eg: map<string,string,ci_less>
Definition: ci_less.h:26
GLsizei const GLchar ** string
Definition: glext.h:3919
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:32



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019