Data Structures | Functions
util Namespace Reference

Data Structures

class  All
 Functor which determines if all values in range evaluate to true. More...

Functions

template<>
double parse< double > (std::string const &str)
template<>
int64_t parse< int64_t > (std::string const &str)
std::string replace (std::string const &input, std::map< char, std::string > const &repl)
 Replaces all occurences of keys from repl in input with their respective values.
template<typename T >
parse (std::string const &str)
 Parse type from std::string using istringstream.
template<typename Sep , typename... Args>
std::string concatenate (Sep sep, Args...args)
 Concatenate args, inserting sep in between using std::ostringstream.
template<typename T >
std::string to_str (T val)
 Simple conversion to string using std::ostringstream.
template<typename Sep , typename Tail >
void concat_impl (std::ostringstream &ss, Sep, Tail t)
template<typename Sep , typename Head , typename... Tail>
void concat_impl (std::ostringstream &os, Sep sep, Head h, Tail...t)
template<typename Eq , typename K , typename V , typename Compare = std::less<K>, typename Allocator = std::allocator<std::pair<const K, V> >>
bool multimap_eq (std::multimap< K, V, Compare, Allocator > const &a, std::multimap< K, V, Compare, Allocator > const &b)
 Determines whether all elements of std::multimap a are in b and if they have equal sizes using Eq as element comparer.
template<typename K , typename V , typename Compare = std::less<K>, typename Allocator = std::allocator<std::pair<const K, V> >>
bool multimap_eq (std::multimap< K, V, Compare, Allocator > const &a, std::multimap< K, V, Compare, Allocator > const &b)
 Determines whether all elements of std::multimap a are in b and if they have equal sizes.
template<typename Eq , typename It , typename T >
It find (It first, It last, T const &value)
 Determines if value is in the range [first,last) using Eq as comparer.
template<typename It , typename T >
It find (It first, It last, T const &value)
 Determines if value is in the range [first,last) (same as std::find)
template<typename Less , typename Eq , typename A , typename B >
bool greater_than_impl (A const &a, B const &b)
template<typename Eq , typename A , typename B >
bool not_eq_impl (A const &a, B const &b)
template<typename Less , typename A , typename B >
bool greater_eq_impl (A const &a, B const &b)
template<typename Less , typename Eq , typename A , typename B >
bool less_eq_impl (A const &a, B const &b)
template<typename A >
bool greater_than_impl (A const &a, A const &b)
template<typename A >
bool not_eq_impl (A const &a, A const &b)
template<typename A >
bool greater_eq_impl (A const &a, A const &b)
template<typename A >
bool less_eq_impl (A const &a, A const &b)
template<typename Eq , typename Col1 , typename Col2 >
bool equal_collection (Col1 c1, Col2 c2)
 Simplified version of std::equal which takes collections instead of ranges, uses Eq as comparer.
template<typename Col1 , typename Col2 >
bool equal_collection (Col1 c1, Col2 c2)
 Simplified version of std::equal which takes collections instead of ranges.

Function Documentation

template<typename Sep , typename Tail >
void util::concat_impl ( std::ostringstream &  ss,
Sep  ,
Tail  t 
)

Definition at line 66 of file util.h.

template<typename Sep , typename Head , typename... Tail>
void util::concat_impl ( std::ostringstream &  os,
Sep  sep,
Head  h,
Tail...  t 
)

Definition at line 72 of file util.h.

template<typename Sep , typename... Args>
std::string util::concatenate ( Sep  sep,
Args...  args 
)

Concatenate args, inserting sep in between using std::ostringstream.

Parameters:
sep
args
Returns:
concatenated string

Definition at line 47 of file util.h.

template<typename Eq , typename Col1 , typename Col2 >
bool util::equal_collection ( Col1  c1,
Col2  c2 
)

Simplified version of std::equal which takes collections instead of ranges, uses Eq as comparer.

Parameters:
c1first collection
c2second collection
Returns:
true if collections contain elements which are equal according to Eq

Definition at line 234 of file util.h.

template<typename Col1 , typename Col2 >
bool util::equal_collection ( Col1  c1,
Col2  c2 
)

Simplified version of std::equal which takes collections instead of ranges.

Parameters:
c1first collection
c2second collection
Returns:

Definition at line 246 of file util.h.

template<typename Eq , typename It , typename T >
It util::find ( It  first,
It  last,
T const &  value 
)

Determines if value is in the range [first,last) using Eq as comparer.

Parameters:
first
last
value
Returns:
true if value is in [first,last)

Definition at line 121 of file util.h.

template<typename It , typename T >
It util::find ( It  first,
It  last,
T const &  value 
)

Determines if value is in the range [first,last) (same as std::find)

Parameters:
first
last
value
Returns:
true if value is in [first,last)

Definition at line 135 of file util.h.

template<typename Less , typename A , typename B >
bool util::greater_eq_impl ( A const &  a,
B const &  b 
)

Definition at line 189 of file util.h.

template<typename A >
bool util::greater_eq_impl ( A const &  a,
A const &  b 
)

Definition at line 216 of file util.h.

template<typename Less , typename Eq , typename A , typename B >
bool util::greater_than_impl ( A const &  a,
B const &  b 
)

Definition at line 174 of file util.h.

template<typename A >
bool util::greater_than_impl ( A const &  a,
A const &  b 
)

Definition at line 204 of file util.h.

template<typename Less , typename Eq , typename A , typename B >
bool util::less_eq_impl ( A const &  a,
B const &  b 
)

Definition at line 196 of file util.h.

template<typename A >
bool util::less_eq_impl ( A const &  a,
A const &  b 
)

Definition at line 222 of file util.h.

template<typename Eq , typename K , typename V , typename Compare = std::less<K>, typename Allocator = std::allocator<std::pair<const K, V> >>
bool util::multimap_eq ( std::multimap< K, V, Compare, Allocator > const &  a,
std::multimap< K, V, Compare, Allocator > const &  b 
)

Determines whether all elements of std::multimap a are in b and if they have equal sizes using Eq as element comparer.

Parameters:
a
b
Returns:
true if equal

Definition at line 85 of file util.h.

template<typename K , typename V , typename Compare = std::less<K>, typename Allocator = std::allocator<std::pair<const K, V> >>
bool util::multimap_eq ( std::multimap< K, V, Compare, Allocator > const &  a,
std::multimap< K, V, Compare, Allocator > const &  b 
)

Determines whether all elements of std::multimap a are in b and if they have equal sizes.

Parameters:
a
b
Returns:

Definition at line 108 of file util.h.

template<typename Eq , typename A , typename B >
bool util::not_eq_impl ( A const &  a,
B const &  b 
)

Definition at line 182 of file util.h.

template<typename A >
bool util::not_eq_impl ( A const &  a,
A const &  b 
)

Definition at line 210 of file util.h.

template<typename T >
T util::parse ( std::string const &  str)

Parse type from std::string using istringstream.

Parameters:
strstring to parse
Returns:
parsed value

Definition at line 24 of file util.h.

template<>
double util::parse< double > ( std::string const &  str)

Definition at line 8 of file util.cpp.

template<>
int64_t util::parse< int64_t > ( std::string const &  str)

Definition at line 14 of file util.cpp.

std::string util::replace ( std::string const &  input,
std::map< char, std::string > const &  repl 
)

Replaces all occurences of keys from repl in input with their respective values.

Parameters:
input
repl
Returns:
input with replacement in place

Definition at line 19 of file util.cpp.

template<typename T >
std::string util::to_str ( val)

Simple conversion to string using std::ostringstream.

Parameters:
val
Returns:

Definition at line 60 of file util.h.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines