|
A library for working with phylogenetic and population genetic data.
v0.27.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_TEXT_CONVERT_H_
2 #define GENESIS_UTILS_TEXT_CONVERT_H_
67 ss >> std::noskipws >> value;
76 throw std::invalid_argument(
"Cannot convert string '" + str +
"' to specified type." );
85 inline std::string convert_from_string<std::string>( std::string
const& str,
bool trim )
99 template<
typename ForwardIterator>
101 ForwardIterator first,
102 ForwardIterator last,
106 std::vector<bool> ret;
110 while( first != last ) {
117 template<
typename ForwardIterator>
119 ForwardIterator first,
122 while( first != last ) {
138 template<
typename ForwardIterator>
140 ForwardIterator first,
141 ForwardIterator last,
145 std::vector<double> ret;
149 while( first != last ) {
156 template<
typename ForwardIterator>
158 ForwardIterator first,
161 while( first != last ) {
177 template<
typename ForwardIterator>
179 ForwardIterator first,
180 ForwardIterator last,
184 std::vector<double> ret;
188 while( first != last ) {
195 template<
typename ForwardIterator>
197 ForwardIterator first,
200 while( first != last ) {
212 #endif // include guard
bool is_convertible_to_bool_double(std::string const &str)
double convert_to_bool_double(std::string const &str)
bool is_convertible_to_bool(Dataframe const &df, size_t col_index)
std::string trim(std::string const &s, std::string const &delimiters)
Return a copy of the input string, with trimmed white spaces.
void convert_to_double(Dataframe &df, size_t col_index)
Provides some commonly used string utility functions.
T convert_from_string(std::string const &str, bool trim=false)
Generic conversion from string to any data type that is supported by std::stringsteam operator >>.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
bool is_convertible_to_double(Dataframe const &df, size_t col_index)
void convert_to_bool(Dataframe &df, size_t col_index)