1 #ifndef _utl_LineStringTo_h_
2 #define _utl_LineStringTo_h_
4 #include <boost/lexical_cast.hpp>
5 #include <boost/algorithm/string/trim.hpp>
18 template<
class T,
bool throwOnError = true,
bool complain = true>
21 { T::operator=(t);
return *
this; }
28 if (std::getline(is, line)) {
29 boost::algorithm::trim(line);
31 obj = boost::lexical_cast<T>(line);
32 }
catch (
const boost::bad_lexical_cast& e) {
34 std::cerr <<
"line '" << line <<
"' could not be converted" << std::endl;
friend std::istream & operator>>(std::istream &is, LineStringTo &obj)
bool is(const double a, const double b)
LineStringTo & operator=(const T &t)