for conversions c++11 provides std::to_string()
e.g. in udev provider there are 2 overloads used (later can be moved to statefs utils):

template <typename T>
static inline std::string statefs_attr(T const &v)
{
    return std::to_string(v);
}

static inline std::string statefs_attr(bool v)
{
    return std::to_string(v ? 1 : 0);
}