-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advanced Custom serialization? #1543
Comments
update: generic object_t works great will probably keep that, but i need a fix for the base specifier thing |
Thanks for bringing up this issue. Here's a solution adding The reason |
It should be easy to handle: template<typename T>
struct SomeValue
{
T value;
} Here is a meta that should work: template <class T>
struct glz::meta<SomeValue<T>>
{
static constexpr auto value = &SomeValue<T>::value; // Tell Glaze to just use the underlying member pointer
}; Now if you write a glz::meta for types that use SomeValue everything should work fine. If SomeValue is aggregate initializable reflection should also work. |
Adding |
I can't get this code to work, I'm probably doing it wrong but I can't figure out what my issue is (according to docs its like this?)
I get an error saying
error: ambiguous template instantiation for 'struct glz::detail::to<10, MyValue>'
https://godbolt.org/z/rEKKWznM9
Also another question, my classes right now are a little bit weird set up, they work somewhat like this:
Is it even possible to write an advanced serialization function? I have two ideas, but they are not great:
SomeValue
specialization and store them in a std::vector<std::pair<std::string, std::variant>>>. This does work but I have to fix a few issues with creating the variant.The other obvious option is using the generic
object_t
and I probably will end up using thatThe text was updated successfully, but these errors were encountered: