On Sat, Jun 8, 2019 at 9:53 AM Helmut Zeisel
Actually I did not check your library, but I would be interested in a formatting library that is not based on functions, but on function objects.
The usage would not be something like
std::string s1 = to_string("base10", 15); std::string s2 = to_string("base16", 42);
but
stringifier dec; dec.set_base(10); std::string s1=hex(15); stringifier hex; hex.set_base(16); std::string s2=hex(42);
To format values in Boost.Stringify, one does like this, for example: namespace strf = boost::stringify; int v = 255; std::string s = strf::to_string(v, " in hexadecimal is ", strf::hex(v)); assert(s == "255 in hexadecimal is ff"); So could maybe lambdas solve your need ? auto hex = [](int v){return strf::to_string(strf::hex(v)); }; auto dec = [](int v){return strf::to_string(v); }; auto s1 = hex(15); auto s2 = dec(42); assert(s1 == "f"); assert(s2 == "42");
With a function object based interface, one could easily store and reuse different formating options in parallel.
Not clear to me what you mean by that. Could you explain better ?