Files
MapLibreParticleLab/include/llmr/util/string.hpp
2014-04-15 14:30:05 -04:00

25 lines
484 B
C++

#ifndef LLMR_UTIL_STRING
#define LLMR_UTIL_STRING
#include <string>
namespace llmr {
namespace util {
template<size_t max, typename... Args>
inline std::string sprintf(const char *msg, Args... args) {
char res[max];
int len = snprintf(res, sizeof(res), msg, args...);
return std::string(res, len);
}
template<size_t max, typename... Args>
inline std::string sprintf(const std::string &msg, Args... args) {
return sprintf<max>(msg.c_str(), args...);
}
}
}
#endif