[PATCH 2/2] libstdc++: Use template form for pretty-printing tuple elements
Jonathan Wakely
jwakely@redhat.com
Wed Jun 16 13:53:16 GMT 2021
On Mon, 14 Jun 2021 at 19:14, Paul Smith via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> std::tuple elements are retrieved via std::get<> (template) not
> [] (array); have the generated output string match this.
Both of your patches seem to be based on the idea that the output is
supposed to correspond to how you access the tuple, but that isn't
meant to be the case. The fact we show [1] isn't suppose to mean you
can access that element as tup[1]. For example, the std::set printer
shows:
$1 = std::set with 3 elements = {[0] = 1, [1] = 2, [2] = 3}
This isn't supposed to imply that you can access the member as s[0].
However, it does use a zero-based index! I think using a zero-based
index for tuples makes sense too, although your patch will cause
testsuite failures, won't it? The test needs to change too.
More information about the Libstdc++
mailing list