Version 5.0.0
Customizable Compile-Time Options
The glz::opts
struct is now only the default options, and more specialized options can be added to user created option structs. See Options for new compile time option customization. In this transition we've moved lesser used options out of the default glz::opts
. This reduces the length of compiler errors when using Glaze and makes handling more options in the future much more manageable.
The options moved out of the default glz::opts
are the following:
// Add these fields to a custom options struct if you want to use them
bool validate_skipped = false;
// If full validation should be performed on skipped values
bool validate_trailing_whitespace = false;
// If, after parsing a value, we want to validate the trailing whitespace
bool concatenate = true;
// Concatenates ranges of std::pair into single objects when writing
bool allow_conversions = true;
// Whether conversions between convertible types are allowed in BEVE, e.g. double -> float
bool write_type_info = true;
// Write type info for meta objects in variants
bool shrink_to_fit = false;
// Shrinks dynamic containers to new size to save memory
bool hide_non_invocable = true;
// Hides non-invocable members from the cli_menu (may be applied elsewhere in the future)
Note
None of these options have been removed or deprecated. To use these options you simply need to create your own options struct with the additional options you wish to use. Simply inherit from glz::opts
and add the fields you would like.
- Make opts use generic by @stephenberry in #1628
Removed detail
namespace for to/from
specializations
When writing custom serialization/parsing logic in Glaze, the to/from
structs to specialize on have been removed from the detail
namespace and are simply in glz
.
Many other concepts and helper functions in Glaze have also been moved out of the detail
namespace for cleaner custom serialization and parsing.
- Removed detail from specializations like to/from in #1625
Changed glz::detail::read
to glz::parse
and glz::detail::write
to glz::serialize
The helper type deduction functors named glz::detail::read
and glz::detail::write
were confusing, because these were different than the functions glz::read
and glz::write
. These helper functors have been moved out of the detail namespace and renamed to parse
and serialize
for easier to read custom serialization and parsing.
Generic Supported Concepts
The format specific concepts like: read_json_supported
and write_beve_supported
added extra boilerplate and did not allow custom formats. This change removes these non-generic functions and simply uses:
template <uint32_t Format, class T>
concept write_supported = requires { detail::to<Format, std::remove_cvref_t<T>>{}; };
template <uint32_t Format, class T>
concept read_supported = requires { detail::from<Format, std::remove_cvref_t<T>>{}; };
This more generic solution simplifies the code and makes adding new formats cleaner and possible for users without needing to modify the main Glaze repository.
- Generic supported concepts in #1622
Minor fixes
In development
- For
glz::asio_server
, if port is 0, allow access to assigned port in #1621
Full Changelog: v4.4.3...v5.0.0