loom
1#include "simodo/inout/format/fmt.h"
2
3namespace simodo::inout
4{
5void fmt::replace(const char * s, size_t size)
6{
7if (_shift > 10*2)
8throw std::overflow_error("The number of formatting arguments exceeds the allowed number");
9
10if (size == std::string::npos)
11size = std::strlen(s);
12
13std::string::size_type pos = 0;
14
15while(true) {
16pos = _str.find(FMT_PATTERN+_shift, pos, 2);
17
18if (pos == std::string::npos)
19break;
20
21_str.replace(pos,2,s);
22pos += size;
23}
24}
25}
26