32#ifndef _HUGIN_UTILS_STL_UTILS_H
33#define _HUGIN_UTILS_STL_UTILS_H
49 inline std::string
tolower(
const std::string&
s)
51 std::string result =
s;
52 std::transform<std::string::iterator,
53 std::string::iterator,
54 int (*)(
int)>(result.begin(), result.end(),
59 inline std::string
toupper(
const std::string&
s)
61 std::string result =
s;
62 std::transform<std::string::iterator,
63 std::string::iterator,
64 int (*)(
int)>(result.begin(), result.end(),
72template<
typename _Container>
76 return c.find(
key) != c.end();
80template<
typename _Container>
82 typename _Container::key_type end)
84 for (
typename _Container::key_type
i=begin;
i <= end;
i++) {
98typename Map::mapped_type &
map_get(
Map &m,
const typename Map::key_type &
key)
100 typename Map::iterator
it = m.find(
key);
105 throw std::out_of_range(
"No such element in vector");
109template<
typename Map>
112 typename Map::const_iterator
it = m.find(
key);
117 throw std::out_of_range(
"No such element in vector");
122template<
typename Map>
125 typename Map::iterator
it = m.find(
key);
130 throw std::out_of_range(
"No such element in vector");
134template<
typename Map>
137 typename Map::const_iterator
it = m.find(
key);
142 throw std::out_of_range(
"No such element in vector");
namespace for various utils
std::string toupper(const std::string &s)
std::string tolower(const std::string &s)
convert a string to lowercase
bool set_contains(const _Container &c, const typename _Container::key_type &key)
Map::mapped_type & map_get(Map &m, const typename Map::key_type &key)
get a map element.
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
const Map::mapped_type & const_map_get(const Map &m, const typename Map::key_type &key)
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.