Skip to content

Resize semantic #1445

@PerretB

Description

@PerretB

The resize function currently discards all container values (except if the expected size is equal to the current size): this is a major difference with the STL containers behavior.

Example:

xtensor<int, 1> a{0, 1, 2, 3, 4};
a.resize({4});
std::cout << a; // undefined behavior

IMHO an STL compliant API which limits surprises would be better (perhaps with an extra option to disable data copying). This should also be described in the documentation (I maybe missed it).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions