Classes |
struct | bad_lexical_cast |
Namespaces |
namespace | Rivet |
Defines |
#define | UNUSED(x) x |
#define | DEPRECATED(x) |
| Macro to help mark code as deprecated to produce compiler warnings.
|
Functions |
|
template<typename T , typename U > |
T | lexical_cast (const U &in) |
| Convert between any types via stringstream.
|
template<typename T > |
string | to_str (const T &x) |
| Convert any object to a string.
|
template<typename T > |
string | toString (const T &x) |
| Convert any object to a string.
|
string & | replace_first (string &str, const string &patt, const string &repl) |
| Replace the first instance of patt with repl.
|
string & | replace_all (string &str, const string &patt, const string &repl) |
| Replace all instances of patt with repl.
|
int | nocase_cmp (const string &s1, const string &s2) |
| Case-insensitive string comparison function.
|
bool | nocase_equals (const string &s1, const string &s2) |
| Case-insensitive string equality function.
|
string | toLower (const string &s) |
| Convert a string to lower-case.
|
string | toUpper (const string &s) |
| Convert a string to upper-case.
|
bool | startsWith (const string &s, const string &start) |
| Check whether a string start is found at the start of s.
|
bool | endsWith (const string &s, const string &end) |
| Check whether a string end is found at the end of s.
|
template<typename T > |
string | join (const vector< T > &v, const string &sep=" ") |
| Make a string containing the string representations of each item in v, separated by sep.
|
template<typename T > |
string | join (const set< T > &s, const string &sep=" ") |
| Make a string containing the string representations of each item in s, separated by sep.
|
|
vector< string > | pathsplit (const string &path) |
| Split a path string with colon delimiters.
|
string | pathjoin (const vector< string > &paths) |
| Join several filesystem paths together with the standard ':' delimiter.
|
|
template<typename CONTAINER > |
unsigned int | count (const CONTAINER &c) |
| Return number of elements in the container c for which f(x) is true.
|
template<typename CONTAINER , typename FN > |
unsigned int | count (const CONTAINER &c, const FN &f) |
| Return number of elements in the container c for which f(x) is true.
|
template<typename CONTAINER > |
bool | any (const CONTAINER &c) |
| Return true if x is true for any x in container c, otherwise false.
|
template<typename CONTAINER , typename FN > |
bool | any (const CONTAINER &c, const FN &f) |
| Return true if f(x) is true for any x in container c, otherwise false.
|
template<typename CONTAINER > |
bool | all (const CONTAINER &c) |
| Return true if x is true for all x in container c, otherwise false.
|
template<typename CONTAINER , typename FN > |
bool | all (const CONTAINER &c, const FN &f) |
| Return true if f(x) is true for all x in container c, otherwise false.
|
template<typename CONTAINER > |
bool | none (const CONTAINER &c) |
| Return true if x is false for all x in container c, otherwise false.
|
template<typename CONTAINER , typename FN > |
bool | none (const CONTAINER &c, const FN &f) |
| Return true if f(x) is false for all x in container c, otherwise false.
|
template<typename C1 , typename C2 , typename FN > |
const C2 & | transform (const C1 &in, C2 &out, const FN &f) |
| A single-container-arg version of std::transform, aka map .
|
template<typename C1 , typename T , typename FN > |
T | accumulate (const C1 &in, const T &init, const FN &f) |
| A single-container-arg version of std::accumulate, aka reduce .
|
template<typename CONTAINER , typename T > |
T | sum (const CONTAINER &c, const T &start=T()) |
| Generic sum function, adding x for all x in container c, starting with start.
|
template<typename CONTAINER , typename FN , typename T > |
T | sum (const CONTAINER &c, const FN &f, const T &start=T()) |
| Generic sum function, adding fn(x ) for all x in container c, starting with start.
|
template<typename CONTAINER , typename FN > |
CONTAINER & | ifilter_discard (CONTAINER &c, const FN &f) |
| Filter a collection in-place, removing the subset that passes the supplied function.
|
template<typename CONTAINER , typename FN > |
CONTAINER | filter_discard (const CONTAINER &c, const FN &f) |
| Filter a collection by copy, removing the subset that passes the supplied function.
|
template<typename CONTAINER , typename FN > |
CONTAINER & | filter_discard (const CONTAINER &c, const FN &f, CONTAINER &out) |
template<typename CONTAINER , typename FN > |
CONTAINER & | ifilter_select (CONTAINER &c, const FN &f) |
| Filter a collection in-place, keeping the subset that passes the supplied function.
|
template<typename CONTAINER , typename FN > |
CONTAINER | filter_select (const CONTAINER &c, const FN &f) |
| Filter a collection by copy, keeping the subset that passes the supplied function.
|
template<typename CONTAINER , typename FN > |
CONTAINER & | filter_select (const CONTAINER &c, const FN &f, CONTAINER &out) |
template<typename CONTAINER > |
CONTAINER | slice (const CONTAINER &c, int i, int j) |
| Slice of the container elements cf. Python's [i:j] syntax.
|
template<typename CONTAINER > |
CONTAINER | slice (const CONTAINER &c, int i) |
| Tail slice of the container elements cf. Python's [i:] syntax.
|
template<typename CONTAINER > |
CONTAINER | head (const CONTAINER &c, int n) |
| Head slice of the n first container elements.
|
template<typename CONTAINER > |
CONTAINER | tail (const CONTAINER &c, int n) |
| Tail slice of the n last container elements.
|
double | min (const vector< double > &in, double errval=DBL_NAN) |
| Find the minimum value in the vector.
|
double | max (const vector< double > &in, double errval=DBL_NAN) |
| Find the maximum value in the vector.
|
pair< double, double > | minmax (const vector< double > &in, double errval=DBL_NAN) |
| Find the minimum and maximum values in the vector.
|
int | min (const vector< int > &in, int errval=-1) |
| Find the minimum value in the vector.
|
int | max (const vector< int > &in, int errval=-1) |
| Find the maximum value in the vector.
|
pair< int, int > | minmax (const vector< int > &in, int errval=-1) |
| Find the minimum and maximum values in the vector.
|
Variables |
static constexpr double | DBL_NAN = std::numeric_limits<double>::quiet_NaN() |
| Convenient const for getting the double NaN value.
|