utils: Update error exception, utils.
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
#define __MU_UTILS_HH__
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <cstdarg>
|
||||
#include <glib.h>
|
||||
@ -136,6 +137,24 @@ std::string size_to_string (const std::string& sizestr, bool first);
|
||||
std::string size_to_string (int64_t size);
|
||||
|
||||
|
||||
/**
|
||||
* Convert any ostreamable<< value to a string
|
||||
*
|
||||
* @param t the value
|
||||
*
|
||||
* @return a std::string
|
||||
*/
|
||||
template <typename T>
|
||||
static inline std::string to_string (const T& val)
|
||||
{
|
||||
std::stringstream sstr;
|
||||
sstr << val;
|
||||
|
||||
return sstr.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* don't repeat these catch blocks everywhere...
|
||||
|
||||
Reference in New Issue
Block a user