Skip to content

🐞 Some tuple get operations don't work as described in the documentation #148

@lukevalenty

Description

@lukevalenty

A few of the tuple get operations aren't working as described, here's a unit test that will illustrate the issue:

TEST_CASE("member get indexing", "[tuple]") {
    using namespace stdx::literals;
    constexpr auto t = stdx::tuple{1, true};

    static_assert(1 == t[stdx::index<0>]); // works
    static_assert(1 == t[0_idx]);          // works
    static_assert(1 == t[stdx::tag<int>]); // fails

    static_assert(1 == t.get(stdx::index<0>)); // fails
    static_assert(1 == t.get(0_idx));          // fails
    static_assert(1 == t.get(stdx::tag<int>)); // fails
}

The above test was adapted from the tuple documentation:

`get` is also available as a member function on `stdx::tuple` and works either

`get` is also available as a member function on `stdx::tuple` and works either
by index or by type (using the `tag` variable template):
[source,cpp]
----
using namespace stdx::literals;
auto t = stdx::tuple{1, true};
auto x_by_index1 = t.get(index<0>);
auto x_by_index2 = t.get(0_idx);
auto x_by_type = t.get(tag<int>);
----

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions