Why does the prettyprint of std::tuple start with [1]?

Paul Smith paul@mad-scientist.net
Sun Jun 13 13:49:40 GMT 2021


Am I the only one to be confused by the fact that the pretty-printer
for std::tuple values starts indexing at 1 instead of 0?

(gdb) p info
$1 = (const std::tuple<TestType, DataType> &) @0x7fffffffd550: {
  param = std::tuple containing = {
    [1] = TestType::OneTest,
    [2] = DataType::SomeData
  },
  index = 2
}

Why aren't the indexes on the left numbered [0] and [1], corresponding
to the values used with std::get(), instead of [1] and [2]?



More information about the Gdb mailing list