blob: f17d55cec3150288af6bdf9417aa052df8393d14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#ifndef MBGL_UTIL_STRING
#define MBGL_UTIL_STRING
#include <string>
namespace mbgl {
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
|