github stephenberry/glaze v2.2.2
2.2.2

latest releases: v9.0.0, v8.4.0, v8.3.0...
2 years ago

Breaking Change

  • glaze/json/study.hpp must now be explicitly included. It is not included by default in glaze/json.hpp or glaze/glaze.hpp, in order to remove threading dependencies for most users.
  • This only affects users implementing the study tools, which is not common.
  • by @stephenberry in #811

Improvements

Example of partial writing:

struct animals_t
{
   std::string lion = "Lion";
   std::string tiger = "Tiger";
   std::string panda = "Panda";

   struct glaze
   {
      using T = animals_t;
      static constexpr auto value = glz::object(&T::lion, &T::tiger, &T::panda);
   };
};

struct zoo_t
{
   animals_t animals{};
   std::string name{"My Awesome Zoo"};

   struct glaze
   {
      using T = zoo_t;
      static constexpr auto value = glz::object(&T::animals, &T::name);
   };
};

"partial write"_test = [] {
      static constexpr auto partial = glz::json_ptrs("/name", "/animals/tiger");

      zoo_t obj{};
      std::string s{};
      const auto ec = glz::write_json<partial>(obj, s);
      expect(!ec);
      expect(s == R"({"animals":{"tiger":"Tiger"},"name":"My Awesome Zoo"})") << s;
   };

Fixes

Full Changelog: v2.2.1...v2.2.2

Don't miss a new glaze release

NewReleases is sending notifications on new releases.