glaze
glaze copied to clipboard
string_t concept should have append method instead of push_back
This concept currently requires that a string_t type has a push_back method:
// this concept requires that T is string and copies the string in json
template <class T>
concept string_t = str_t<T> && !std::same_as<std::decay_t<T>, std::string_view> && has_push_back<T>;
but I noticed that in the code where string_t is used, we do not need push_back, but rather resize, append and / or assign (sometimes only assign, for instance when raw_string is true). I think we would need to simplify that as it makes the custom read for a custom struct hard to define.
I have created a test PR to illustrate the issue. It needs a unit test to cover the fix though.
Thanks for this. I'll try to get these updates merged soon.