-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Glaze does not detect variant objects within variants #1096
Comments
This issue is due to the fact that a I think the filtering code needs to be improved and optimized before this feature is added. I've pasted the current filtering code below. I'm removing the I did improve the template <class>
struct variant_types;
template <class... Ts>
struct variant_types<std::variant<Ts...>>
{
// TODO: this way of filtering types is compile time intensive.
using bool_types = decltype(tuplet::tuple_cat(
std::conditional_t<bool_t<remove_meta_wrapper_t<Ts>>, tuplet::tuple<Ts>, tuplet::tuple<>>{}...));
using number_types = decltype(tuplet::tuple_cat(
std::conditional_t<num_t<remove_meta_wrapper_t<Ts>>, tuplet::tuple<Ts>, tuplet::tuple<>>{}...));
using string_types = decltype(tuplet::tuple_cat( // glaze_enum_t remove_meta_wrapper_t supports constexpr
// types while the other supports non const
std::conditional_t < str_t<remove_meta_wrapper_t<Ts>> || glaze_enum_t<remove_meta_wrapper_t<Ts>> ||
glaze_enum_t<Ts>,
tuplet::tuple<Ts>, tuplet::tuple < >> {}...));
using object_types =
decltype(tuplet::tuple_cat(std::conditional_t<json_object<Ts>, tuplet::tuple<Ts>, tuplet::tuple<>>{}...));
using array_types =
decltype(tuplet::tuple_cat(std::conditional_t < array_t<remove_meta_wrapper_t<Ts>> || glaze_array_t<Ts>,
tuplet::tuple<Ts>, tuplet::tuple < >> {}...));
using nullable_types =
decltype(tuplet::tuple_cat(std::conditional_t<null_t<Ts>, tuplet::tuple<Ts>, tuplet::tuple<>>{}...));
using nullable_objects = decltype(tuplet::tuple_cat(
std::conditional_t<is_memory_object<Ts>, tuplet::tuple<Ts>, tuplet::tuple<>>{}...));
}; |
Hi,
Consider the following code snippet from the library, at which I have added some debugging:
the output looks like this:
That is not correct. Our input T type is a std::variant consisting of 3 types. last 2 types from this variant are themselves variants. The wanted output should have been:
The text was updated successfully, but these errors were encountered: