Add UDT support to value_ref via value_from #1128
Draft
+205
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enables user-defined types (UDTs) to work in
value_refinitializer lists by routing non-native types throughvalue_fromconversion.Previously, UDTs with
tag_invokeoverloads forvalue_from_tagcould not be used directly in array/object initializer lists becausevalue_ref::from_constandfrom_rvalueonly supported types with nativevalueconstructors.Changes
value_ref.hpp: Addedis_native_value_type<T>trait identifying types with directvalueconstructors (JSON types, numerics, string-like, nullptr)impl/value_ref.hpp: Tag dispatch infrom_const_implandfrom_rvalue_implto usevalue_from()for non-native typestest/value_ref.cpp: Tests for UDTs in initializer lists, object values, and nested structuresExample
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https /usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.