Skip to content

Releases: stephenberry/glaze

v5.0.0

05 Mar 14:29
Compare
Choose a tag to compare

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.

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

v4.4.3

18 Feb 22:10
Compare
Choose a tag to compare

Removed lots of internal macros for the use of Glaze as a C++20 module (in development).

In Development

  • Removed macros in #1614
  • Remove forced reflection for top level structs in repe::registry by @stephenberry in #1623

Full Changelog: v4.4.2...v4.4.3

v4.4.2

14 Feb 17:18
Compare
Choose a tag to compare

Fixes

  • Fix trailing comma for tagged variants with null members in #1609
  • Fix for empty objects with tagged variants in #1610

Improvements

  • Added support for custom static strings by @SlaaneshChosen in #1605
    • Use glaze_static_string = true in your glz::meta for your static string type.

In Development

Full Changelog: v4.4.1...v4.4.2

v4.4.1

07 Feb 22:08
Compare
Choose a tag to compare

Fixes

  • Fix mismatch create function for shared library API (missing noexcept) in #1596
  • Fix ODR violations by @arturbac in #1604

Improvements

  • Safer boolean write to avoid issues with UB booleans (non-initialized booleans) in #1597
  • Add error_handler to asio_server by @stephenberry in #1602

Full Changelog: v4.4.0...v4.4.1

v4.4.0

04 Feb 20:10
Compare
Choose a tag to compare

Improvements

  • Adds feature test macros for recent breaking changes in #1582
  • Unify defines for tests in #1585

Fixes

  • Fix wrong begin/end indices in get_name by @PaideiaDilemma in #1569
  • reflect: fix uint16 compile error in find_unique_sized_index by @timsjostrand in #1575
  • ASAN non null_terminated fix in #1583
  • New CMake option glaze_DISABLE_SIMD_WHEN_SUPPORTED to disable SIMD like AVX2 when cross-compiling by @arturbac in #1590
    • Glaze no longer adds compiler intrinsic flags to its CMake interface definition, and instead relies on the developer's compiler flags

Test Improvements

  • Testing with -Wall and -Werror for GCC (13+) by @stephenberry in #1563
    • Fixed a number of warnings

Full Changelog: v4.3.1...v4.4.0

v4.3.1

13 Jan 17:05
Compare
Choose a tag to compare

Improvements

Fixes

Full Changelog: v4.3.0...v4.3.1

v4.3.0

06 Jan 18:39
Compare
Choose a tag to compare

New append_arrays compile time option

Adds the compile time option (and wrapper) append_arrays, which appends data to types like std::vector rather than overwrite. (#1549)

Example:

std::vector<int> v{};
constexpr glz::opts append_opts{.append_arrays = true};
expect(not glz::read<append_opts>(v, "[1,2,3]"));
expect(v == std::vector<int>{1,2,3});
expect(not glz::read<append_opts>(v, "[4,5,6]"));
expect(v == std::vector<int>{1,2,3,4,5,6});

Improvements

  • Support for dynamically sized Eigen types by @WanZhiQiu-ac in #1541
  • Support for reflection with Eigen vector types in #1552
  • Improved glz::async_string with more methods and std::format support by @stephenberry in #1536, #1538
  • Cleanup of map writing in #1542
  • Fix for always_null_t in object handling and faster always null write in #1545
  • More efficient numerical keys in dynamic maps in #1546

Minor Deprecation

  • Removed global glz::trace in #1544

Because C++ has inline variables and other ways to make global instances it is better to let the programmer handle global instances of glz::trace rather than offer two separate APIs. This also removes the unnecessary glz::write_file_trace as glz::write_file_json(trace is more generic and there is no longer a global instance of the trace.

New Contributors

Full Changelog: v4.2.4...v4.3.0

v4.2.4

02 Jan 16:18
Compare
Choose a tag to compare

Improvements

  • Skipping and tuple cleanup in #1531
  • Faster writing in #1534
  • number option clarification and better errors in #1535

In Development

Full Changelog: v4.2.3...v4.2.4

v4.2.3

26 Dec 20:37
Compare
Choose a tag to compare

Improvements

Fixes

  • Fixed glz::merge with empty objects in #1519 (thanks @SenseOnline)
  • Fixed enum string read for vector of pairs in concatenate mode by @sjanel in #1525

In Development

  • REPE conformance for registry errors in #1526

Full Changelog: v4.2.2...v4.2.3

v4.2.2

18 Dec 15:45
Compare
Choose a tag to compare

Slice support for glz::read_jmespath

std::vector<int> data{0,1,2,3,4,5,6,7,8,9};
std::string buffer{};
expect(not glz::write_json(data, buffer));

std::vector<int> slice{};
expect(not glz::read_jmespath<"[0:5]">(slice, buffer));
expect(slice.size() == 5);
expect(slice[0] == 0);
expect(slice[1] == 1);
expect(slice[2] == 2);
expect(slice[3] == 3);
expect(slice[4] == 4);

Pre-compute JMESPath run-time expressions

The run-time version of glz::read_jmespath also now takes in a const jmespath_expression&. This allows a jmespath_expression to be "compiled" once in the code and reused for much better runtime performance. This caches the tokenization.

Person child{};
// A runtime expression can be pre-computed and saved for more efficient lookups
glz::jmespath_expression expression{"family.children[0]"};
expect(not glz::read_jmespath(expression, child, buffer));
expect(child.first_name == "Lilly");

Note that this still works:

expect(not glz::read_jmespath("family.children[0]", child, buffer));

by @stephenberry in #1510

Fixes

  • Include missing version header that could cause segfaults with GCC in #1508 (Many thanks to @hs-vc)

Full Changelog: v4.2.1...v4.2.2