json icon indicating copy to clipboard operation
json copied to clipboard

Investigate generating into string from user structures directly

Open denzor200 opened this issue 3 years ago • 1 comments

There is only issue about parsing here: https://github.com/boostorg/json/issues/627 But the generating is also actual question and it is also could potentially gain a lot of performance.

E.g.

template<class V, class OI>
void
generate_into(
    OI sink,
    const V& v);

std::vector<int> v{1, 2, 3};
std::string s;
boost::json::generate_into(std::back_inserter(s), v);
std::cout << s << std::endl; // [1, 2, 3]

denzor200 avatar Nov 04 '22 22:11 denzor200

This proof of concept already works: https://github.com/boostorg/json/pull/791

What is missing:

  • tests
  • metaprogramming
  • fixes to the stack for alignment/space optimization
  • documentation
  • examples

vinniefalco avatar Nov 04 '22 22:11 vinniefalco