libStatGen Software
1
|
This file is inspired by the poor quality of string support in STL for what should be trivial capabiltiies, for example setting or appending the ASCII representation of a floating point or integer number to a string. More...
Functions | |
int | Tokenize (std::vector< std::string > &result, const char *input, char delimiter) |
std::string & | append (std::string &s, float f) |
use std streams API to do float conversion to string, then append it. | |
std::string & | append (std::string &s, double f) |
use std streams API to do double conversion to string, then append it. | |
std::string & | append (std::string &s, char c) |
The rest we can handle readily ourselves. More... | |
std::string & | append (std::string &s, unsigned char c) |
Similar to signed char case, but this time for unsigned. | |
std::string & | append (std::string &s, const char *rhs) |
Now append a full C style NUL terminated string to the std::string. | |
std::string & | append (std::string &s, std::string &rhs) |
Prevent the generic template from picking up std::string. | |
template<typename T > | |
std::string & | append (std::string &s, std::vector< T > v, std::string separator="") |
iterate over the provided vector, appending all elements with an optional separator | |
template<typename T > | |
std::string & | append (std::string &s, T i) |
This template handles the rest of the cases for integral types. More... | |
std::string & | operator<< (std::string &s, char c) |
std::string & | operator<< (std::string &s, unsigned char c) |
std::string & | operator<< (std::string &s, uint64_t i) |
std::string & | operator<< (std::string &s, int64_t i) |
template<typename T > | |
std::string & | operator<< (std::string &s, T val) |
template<typename S > | |
std::string & | append (std::string &s, std::vector< std::string > v, S delimeter, bool itemize=false) |
template<typename T , typename S > | |
std::string & | append (std::string &s, std::vector< T > v, S delimeter, bool itemize=false) |
This file is inspired by the poor quality of string support in STL for what should be trivial capabiltiies, for example setting or appending the ASCII representation of a floating point or integer number to a string.
This file uses variadic templates to implement a type safe version (subset) of C-library printf.
Therefore, -std=c++0x is a required option on g++
|
inline |
The rest we can handle readily ourselves.
Unlike std::string operator +, this operator treats c as a character and appends the ASCII character c.
Definition at line 75 of file STLUtilities.h.
std::string& STLUtilities::append | ( | std::string & | s, |
T | i | ||
) |
This template handles the rest of the cases for integral types.
Not user friendly if you pass in a type T that is for example a std::vector.
Definition at line 128 of file STLUtilities.h.