X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Finclude%2Fstringify.h;fp=src%2Fceph%2Fsrc%2Finclude%2Fstringify.h;h=1b2a130c9301d0764bf6cf1cfcc1e62f38843ecc;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/include/stringify.h b/src/ceph/src/include/stringify.h new file mode 100644 index 0000000..1b2a130 --- /dev/null +++ b/src/ceph/src/include/stringify.h @@ -0,0 +1,33 @@ +#ifndef __CEPH_STRINGIFY_H +#define __CEPH_STRINGIFY_H + +#include +#include + +#include "include/types.h" + +template +inline std::string stringify(const T& a) { +#if defined(__GNUC__) && !(defined(__clang__) || defined(__INTEL_COMPILER)) + static __thread std::ostringstream ss; + ss.str(""); +#else + std::ostringstream ss; +#endif + ss << a; + return ss.str(); +} + +template +T joinify(const A &begin, const A &end, const T &t) +{ + T result; + for (A it = begin; it != end; it++) { + if (!result.empty()) + result.append(t); + result.append(*it); + } + return result; +} + +#endif