diff --git a/3380_extend_cnttp_2/extend-cnttp-2.md b/3380_extend_cnttp_2/extend-cnttp-2.md index 9acaf441..30e8cfd1 100644 --- a/3380_extend_cnttp_2/extend-cnttp-2.md +++ b/3380_extend_cnttp_2/extend-cnttp-2.md @@ -795,9 +795,10 @@ For template-argument equivalence, we can say that two values of class type `C` ```cpp consteval auto template_argument_equivalent(C const& a, C const& b) -> bool { struct Serializer { - std::vector v; + std::vector $output$; + consteval auto push(std::meta::info r) -> void { - v.push_back(r); + $output$.push_back(r); } // ... rest of API ... @@ -806,7 +807,7 @@ consteval auto template_argument_equivalent(C const& a, C const& b) -> bool { Serializer sa, sb; a.to_meta_representation(sa); b.to_meta_representation(sb); - return sa.v == sb.v; + return sa.$output$ == sb.$output$; } ``` ::: @@ -832,13 +833,13 @@ const C $object$ = []{ auto $serializer$ = $make-serializer$(); c.to_meta_representation($serializer$); - auto $deserializer$ = $make-deserializer$($serializer$); + auto $deserializer$ = $make-deserializer-from$($serializer$); return C::from_meta_representation($deserializer$); }(); ``` ::: -The actual types of the (de)serializer objects are implementation-defined, the only thing that matters is that they conform to the interface above. +The actual types of the (de)serializer objects are implementation-defined, the only thing that matters is that they conform to the interface above. Note that, as a sanity check, the implementation could do a _second_ serialization round after the round-trip, do ensure that both the original and new values produce the same serialization. We will also have to adjust `std::meta::reflect_value()` to also do this normalization. Which means: diff --git a/3380_extend_cnttp_2/p3380r1.html b/3380_extend_cnttp_2/p3380r1.html index 6f0475de..a49f2d32 100644 --- a/3380_extend_cnttp_2/p3380r1.html +++ b/3380_extend_cnttp_2/p3380r1.html @@ -1543,19 +1543,20 @@

consteval auto template_argument_equivalent(C const& a, C const& b) -> bool {
     struct Serializer {
-        std::vector<std::meta::info> v;
-        consteval auto push(std::meta::info r) -> void {
-            v.push_back(r);
-        }
-
-        // ... rest of API ...
-    };
-
-    Serializer sa, sb;
-    a.to_meta_representation(sa);
-    b.to_meta_representation(sb);
-    return sa.v == sb.v;
-}
+ std::vector<std::meta::info> output; + + consteval auto push(std::meta::info r) -> void { + output.push_back(r); + } + + // ... rest of API ... + }; + + Serializer sa, sb; + a.to_meta_representation(sa); + b.to_meta_representation(sb); + return sa.output == sb.output; +}

That is, two values are template-argument-equivalent if they @@ -1581,14 +1582,17 @@

3 auto serializer = make-serializer(); c.to_meta_representation(serializer); - auto deserializer = make-deserializer(serializer); + auto deserializer = make-deserializer-from(serializer); return C::from_meta_representation(deserializer); }();

The actual types of the (de)serializer objects are implementation-defined, the only thing that matters is that they conform -to the interface above.

+to the interface above. Note that, as a sanity check, the implementation +could do a second serialization round after the round-trip, do +ensure that both the original and new values produce the same +serialization.

We will also have to adjust std::meta::reflect_value() to also do this normalization. Which means: