What's the difference between glz::manage
and glz::custom
now?
#498
-
Until the recent release, custom read takes a string parameter (for parsing the value string manually I am guessing). Now they both take the object for the parameter, so I wondered what the difference is? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I plan to document these better in the future. They are recent additions. Thanks for your interest! glz::custom<&T::read, &T::write> // calls custom read and write std::functions or member functions |
Beta Was this translation helpful? Give feedback.
-
Thanks! And for confirming the behaviour I suspected, because the comment for |
Beta Was this translation helpful? Give feedback.
glz::custom
has two parameters, which can be a member pointer, a std::function, or a lambda function. These two parameters are directly associated with reading and writing.glz::manage
is useful when you want to add custom handling around reading from and writing to a specific member. So,glz::manage
takes three parameters, where the first is the value that is being manipulated and the latter two parameters are read and write functions. Manage is especially useful for values that you want to treat like the root value, but may be connect to hardware and thus need to be read/written before the encode/decode to JSON can occur.I plan to document these better in the future. They are recent ad…