|
template<typename T , typename... Args> |
std::unique_ptr< T > | make_unique (Args &&...args) |
| construct a new object of type T and wraps it with a std::unique_ptr. This is support legacy compiles (e.g. g++ 4.8.x) that do not yet support std::make_unique<T>. More...
|
|
template<typename T > |
T && | MoveUniquePtr (const std::unique_ptr< T > &ptr) |
| utility function to move an object pointed by a std::unique_ptr. After the move operation, the unique_ptr will hold an invalid object. Usage example: More...
|
|
void | WrapText (std::ostringstream *p_stm, size_t *p_length, const std::string &str, size_t indent, size_t textwidth) |
| insert a string into a string stream, adding a newline character (
) so that the string stream has no line longer than the given width. More...
|
|
template<class Iter , class T > |
Iter | binary_search (Iter begin, Iter end, const T &val) |
| perform binary search on the range [begin, end). More...
|
|
template<typename T > |
std::string | ToString (T value) |
| obtain a string representation of primitive type using ostringstream More...
|
|
void | WriteToFile (const std::string &filename, const std::string &content) |
| write a sequence of strings to a text file, with newline character (
) inserted between strings. This function is suitable for creating multi-line text files. More...
|
|
void | TransformPushBack (std::vector< std::string > *p_dest, const std::vector< std::string > &lines, std::function< std::string(std::string)> func) |
| apply a given transformation to a sequence of strings and append them to another sequence. More...
|
|
template<typename T > |
T | TextToNumber (const std::string &str) |
| convert text to number More...
|
|
template<> |
float | TextToNumber (const std::string &str) |
|
template<> |
double | TextToNumber (const std::string &str) |
|
template<> |
int | TextToNumber (const std::string &str) |
|
template<> |
int8_t | TextToNumber (const std::string &str) |
|
template<> |
uint32_t | TextToNumber (const std::string &str) |
|
template<typename T > |
std::vector< T > | TextToArray (const std::string &text, int num_entry) |
| convert text to number array More...
|
|
std::vector< std::string > | Split (const std::string &text, char delim) |
| split text using a delimiter More...
|
|
bool | CompareWithOp (treelite::tl_float lhs, treelite::Operator op, treelite::tl_float rhs) |
| perform comparison between two float's using a comparsion operator The comparison will be in the form [lhs] [op] [rhs]. More...
|
|
Some useful utilities.
Some useful math utilities.
Copyright by 2017 Contributors
- Author
- Philip Cho
Definition in file common.h.