Releases: stephenberry/glaze
1.8.4
Improvements
- Much faster integer reading
Fixes
- BEVE now writes out
glz::file_include
as an empty string. This makes it valid rather than noncompliant.
1.8.3
Improvements
- Added
glz::write
interface that returns a std::string:auto str = glz::write<glz::opts{}>(value);
- BEVE support for
glz::obj
- Minor optimizations, including faster boolean reading
Critical Fixes
- Fixed an issue on MSVC where the wrong name could be given when reflecting on member object pointers
1.8.2
Improvements
- Faster JSON object writing for structs in common cases
- Faster string writing for JSON using SWAR
- Binary writing optimizations
- Added glz::meta reflection support for CSV
- Other minor improvements, more documentation, and more unit tests
Fixes
- Fixed MSVC binary file reading
1.8.1
Improvements
- Found a way to get MSVC to reflect on member object pointers. Now all three compilers GCC, Clang, and MSVC support the same glz::meta reflection from version 1.8.0!
- Added reflection handling for BEVE binary format.
1.8.0
GCC and Clang glz::meta reflection!
In the past you were required to write out the key name along with the member object pointer in your glz::meta
definition. As of 1.8.0, on GCC and Clang the key names are entirely optional. You can individually include custom key names as needed, but otherwise simple reflection will use the name of your member variable.
Instead of writing:
template <>
struct glz::meta<my_struct> {
using T = my_struct;
static constexpr auto value = object(
"i", &T::i,
"d", &T::d,
"hello", &T::hello,
"arr", &T::arr
);
};
You can now write:
template <>
struct glz::meta<my_struct> {
using T = my_struct;
static constexpr auto value = object(
&T::i,
&T::d,
&T::hello,
&T::arr
);
};
- This update has zero runtime performance overhead!
- Every field can be individually named and customized as before
- The reflection is very simple and doesn't use esoteric hacks
- The reflection works on all types, non-aggregates, non-default constructible, non-constexpr etc.
NOTE: If you want comments in your
glz::meta
without providing key names, you must denote those comments explicitly. Glaze now has acomment
type and a_c
literal for denoting comments. These explicit comments are only needed if you remove the key name.
template <>
struct glz::meta<my_struct> {
using T = my_struct;
static constexpr auto value = object(
&T::i, "i is an integer"_c,
&T::d, comment("d is a double"),
&T::hello, "hello is a string"_c,
&T::arr, comment("this is an array of integers")
);
};
This support is currently only for JSON. Next steps will be adding reflection support for wrappers and BEVE.
1.7.1
Major Features
- Thanks to @anaelorlinski, there is now support for handling unknown keys. See this documentation for a good overview. This allows custom read/write handling when unknown keys are encountered.
Improvements
- Clang reflection now supports structs up to 32 elements
1.7.0
Clang Reflection!
For the Clang compiler only, Glaze will reflect your structs. No need to write any glz::meta
structures or use any macros. The reflection is hidden from the user and computed at compile time.
- You can still write a
glz::meta
to customize your serialization, which will override the default reflection. - This approach only works for types that are constexpr constructible, but this includes
std::string
andstd::vector
in newer versions of Clang. - The
glz::meta
approach is still the most optimized. There is some work to be done to make the automatic reflection just as fast. - This approach currently uses Clang's
__builtin_dump_struct
, but we will be able to invisibly move to standard C++ reflection whenever it becomes available.
IMPORTANT:
When writing custom serializers specializing
to_json
orfrom_json
, your concepts for custom types might not take precedence over the reflection engine (when you haven't written aglz::meta
for your type). The reflection engine tries to discern that no specialization occurs for your type, but this is not always possible.To solve this problem, you can add
static constexpr auto reflect = false;
to your class. Or, you can add aglz::meta
for your type.
1.6.2
- Added
approx.hpp
andcompare.hpp
, which allow users to compare C++ struct that have aglz::meta
without needing to define a spaceship operator. Even more useful isglz::approx_equal_to
, which allows users to define a singlecompare_epsilon
in theglz::meta
and compare structures with floating point types against that epsilon. - Lots of internal code cleanup, simplification, and dead code removal
1.6.1
New Features
- Added JSON and BEVE support for
std::bitset
(@stephenberry) - Added JSON support for
std::float128_t
(currently only supported by GCC) (@stephenberry) - Added support for constexpr values in
std::variant
(@jbbjarnason)
Fixes
- MSVC iterator fix (fixes the problem in MSVC where the string_view::iterator is not convertible to pointer directly) (@huangminghuang)
1.6.0
Improvements
- Support for writing unsized ranges (@justend29)
- Support for reading/writing any key types in maps (@justend29)
- Keys can now be complex objects
{"{\"field1\":-1}":"value"}
- Keys can now be complex objects
- Binary BEVE format now supports
std::set
andstd::unordered_set
(@stephenberry)
Fixes
- Minimum signed integers are now properly read/written (@stephenberry)
- Fixed variant tags being rejected when the last entry in an object (@justend29)
- Fixed
get_if
member function of mutableglz::json_t
(@Clyraz) - Fixed issue with BEVE binary always reading bools as true (@dabader)
- Other minor fixes