glaze icon indicating copy to clipboard operation
glaze copied to clipboard

Custom meta<T> without value

Open SenseOnline opened this issue 1 year ago • 1 comments

Thanks for the great library.

It would be nice to be able to do this if it can be supported. To support having an unknown_reader, unknown_writer and maybe others within the custom meta without having to redefine the entirety of the struct.

struct bigJson 
{
   /* ... */
};

template<>
struct glz::meta<bigJson>
{
    static constexpr auto unknown_read{ /* ... */ };
    static constexpr auto unknown_write{ /* ... */ };
};

This currently produces the following error on Visual Studio 2022 due to concept detail::global_meta_t<T> evaluating to false: glaze\json\read.hpp(116,33): static_assert failed: 'unknown_read type not handled'

SenseOnline avatar Dec 24 '24 23:12 SenseOnline

Thanks for bringing this up. It would be nice to be able to specify only the unknown key map and reflect on all the other values automatically. I'll keep this issue alive, but it will probably be some time before it is addressed.

stephenberry avatar Dec 26 '24 20:12 stephenberry

I'm moving this to discussions, because I think this issue requires more long term thought, especially as reflection in C++26 is coming. I don't want to overcomplicate the current reflection mechanisms that will need to be replaced.

stephenberry avatar May 30 '25 12:05 stephenberry