29 template<
typename Container,
30 typename std::enable_if<!std::is_arithmetic<typename Container::value_type>::value,
int>::type = 0>
31 std::string
to_string(
const Container & c,
const std::string & delimiter =
", ")
33 if(c.cbegin() == c.cend()) {
return ""; }
34 std::string out = *c.cbegin();
35 for(
auto it = std::next(c.cbegin()); it != c.cend(); ++it)
49 template<
typename Container,
50 typename std::enable_if<std::is_arithmetic<typename Container::value_type>::value,
int>::type = 0>
52 const std::string & delimiter =
", ",
53 const unsigned precision = std::numeric_limits<typename Container::value_type>::digits10)
55 if(c.cbegin() == c.cend()) {
return ""; }
56 std::ostringstream out;
57 out.precision(precision);
58 out << std::fixed << *c.cbegin();
59 for(
auto it = std::next(c.cbegin()); it != c.cend(); ++it)
62 out << std::fixed << *it;
84 template<
typename Container,
86 typename std::enable_if<!std::is_convertible<Callback, std::string>::value,
int>::type = 0>
87 std::string
to_string(
const Container & c, Callback && get_value,
const std::string & delimiter =
", ")
89 if(c.cbegin() == c.cend()) {
return ""; }
90 std::string out = get_value(*c.cbegin());
91 for(
auto it = std::next(c.cbegin()); it != c.cend(); ++it)
94 out += get_value(*it);