getml / reflect-cpp

A C++20 library for fast serialization, deserialization and validation using reflection. Supports JSON, BSON, CBOR, flexbuffers, msgpack, TOML, XML, YAML / msgpack.org[C++20]
https://getml.github.io/reflect-cpp/
MIT License
783 stars 63 forks source link

fix older msvc(19.36) compilation error #91

Closed toge closed 2 months ago

toge commented 2 months ago

In 0.8.0.0 and 0.9.0, I met a compilation error on older msvc(19.36) followings:

include\rfl\parsing\NamedTupleParser.hpp(99,51): error C2653: 'T': is not a class or namespace name [test_package.vcxproj]
include\rfl\parsing\NamedTupleParser.hpp(90,23): message : This diagnostic occurred in the compiler generated function 'rfl::parsing::schema::Type rfl::parsing::NamedTupleParser<R,W,_ignore_empty_containers,_all_required,FieldTypes...>::to_schema(std::map<std::string,rfl::parsing::schema::Type,std::less<std::string>,std::allocator<std::pair<const std::string,rfl::parsing::schema::Type>>> 

I confirmed it is caused by the line in NamedTupleParser.hpp.

using F = std::tuple_element_t<_i, typename T::Fields>;

This PR try to fix this compilation error.

Please review and merge it if possible.

liuzicheng1987 commented 2 months ago

Cool, thank you so much.

liuzicheng1987 commented 2 months ago

@toge the code changes look good, of course, and the Github Actions pipelines run through as well. So I am going to merge this. Thank you so much for your contribution!

It is really weird, though, that this should be a problem in the first place...