utilities.hxx
|
 |
Go to the documentation of this file.
37 #ifndef VIGRA_BASICS_HXX 38 #define VIGRA_BASICS_HXX 42 #include "metaprogramming.hxx" 45 #include "mathutil.hxx" 59 #define VIGRA_AS_STRING(T) \ 60 inline std::string asString(T t) \ 62 std::stringstream s; \ 68 VIGRA_AS_STRING(
signed char)
69 VIGRA_AS_STRING(
unsigned char)
70 VIGRA_AS_STRING(
signed short)
71 VIGRA_AS_STRING(
unsigned short)
72 VIGRA_AS_STRING(
signed long)
73 VIGRA_AS_STRING(
unsigned long)
74 VIGRA_AS_STRING(
signed long long)
75 VIGRA_AS_STRING(
unsigned long long)
76 VIGRA_AS_STRING(
signed int)
77 VIGRA_AS_STRING(
unsigned int)
78 VIGRA_AS_STRING(
float)
79 VIGRA_AS_STRING(
double)
80 VIGRA_AS_STRING(
long double)
81 VIGRA_AS_STRING(
void *)
83 #undef VIGRA_AS_STRING 86 std::string operator<<(std::string
const & s, T
const & t)
97 for(
unsigned int k=0; k<s.size(); ++k)
98 s[k] = (std::string::value_type)std::tolower(s[k]);
102 inline std::string
tolower(
const char * s)
104 return tolower(std::string(s));
113 for(
unsigned int k=0; k<s.size(); ++k)
115 if(std::isspace(s[k]))
117 res += (std::string::value_type)std::tolower(s[k]);
134 FinallyImpl(T & destructor)
135 : destructor_(destructor)
148 #define VIGRA_TOKEN_PASTE_IMPL(x, y) x##y 149 #define VIGRA_TOKEN_PASTE(x, y) VIGRA_TOKEN_PASTE_IMPL(x, y) 151 #define VIGRA_FINALLY_IMPL(destructor, counter) \ 152 auto VIGRA_TOKEN_PASTE(_vigra_finally_impl_, counter) = [&]() { destructor; }; \ 153 ::vigra::detail::FinallyImpl<decltype(VIGRA_TOKEN_PASTE(_vigra_finally_impl_, counter))> \ 154 VIGRA_TOKEN_PASTE(_vigra_finally_, counter)(VIGRA_TOKEN_PASTE(_vigra_finally_impl_, counter)) 206 #define VIGRA_FINALLY(destructor) \ 207 VIGRA_FINALLY_IMPL(destructor, __COUNTER__) 211 template <
class T1,
class T2>
212 ostream & operator<<(ostream & s, std::pair<T1, T2>
const & p)
214 s <<
"(" << p.first <<
", " << p.second <<
")";
249 #endif // VIGRA_BASICS_HXX std::string tolower(std::string s)
Definition: utilities.hxx:95
Definition: array_vector.hxx:954
Definition: accessor.hxx:43
doxygen_overloaded_function(template<... > void separableConvolveBlockwise) template< unsigned int N
Separated convolution on ChunkedArrays.
std::string asString(T t)(...)
std::string normalizeString(std::string const &s)
Definition: utilities.hxx:109