Skip to content

<utility>: Is extending triviality for pair and tuple on the list of improvements for vNext? #5667

@cristi1990an

Description

@cristi1990an
static_assert(std::is_trivially_copy_assignable_v<std::tuple<int, int>>); // fails
static_assert(std::is_trivially_copy_constructible_v<std::tuple<int, int>>); // fails
static_assert(std::is_trivially_copy_assignable_v<std::pair<int, int>>); // fails
static_assert(std::is_trivially_copy_constructible_v<std::pair<int, int>>); // passes

Current the implementation of pair and tuple is not trivially copy constructible and assignable when their underlying types are, which I assume hinders performance and certain optimizations - which is a shame since they should be zero cost abstractions. Implementing this improvement is an obvious ABI break and I believe it would require rewriting a big chunk of the tuple implementation. I was wondering if this improvement is considered in the vNext abi break - I know tuple compresssion of empty types is, but I haven't seen any discurssion on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceMust go fastervNextBreaks binary compatibility

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions