Main MRPT website
>
C++ reference for MRPT 1.4.0
mrpt
utils
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-2016, 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
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition
CParticleFilter.h:17
mrpt::utils::ci_less::nocase_compare
Definition
ci_less.h:29
mrpt::utils::ci_less::nocase_compare::operator()
bool operator()(const char c1, const char c2) const
Definition
ci_less.h:30
mrpt::utils::ci_less
A case-insensitive comparator struct for usage within STL containers, eg: map<string,...
Definition
ci_less.h:27
mrpt::utils::ci_less::operator()
bool operator()(const std::string &s1, const std::string &s2) const
Definition
ci_less.h:32
Page generated by
Doxygen 1.9.8
for MRPT 1.4.0 SVN: at Thu Dec 14 16:41:50 UTC 2023