Skip to content

Feature Request: constexpr glz::read_json and more #2415

@orhosko

Description

@orhosko

I don't know whether is there a specific blocker to implement something like this. However, with C++26's #embed, I would like to be able to do something like this.

  struct Config {
      int foo{};
  };

  template <>
  struct glz::meta<Config> {
      using T = Config;
      static constexpr auto value = object("foo", &T::foo);
  };

    static constexpr char config_json[] = {
        #embed "config.json"
    };

    static constexpr Config conf;
    static constexpr auto error = glz::read_json(conf, config_json);

    static_assert(error.ec != glz::error_code::none);
    static_assert(conf->foo == 10);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions