Skip to content

<vector>: assign_range() is missing Mandates #5076

@hewillk

Description

@hewillk

According to [sequence.reqmts], a.assign_range(rg) has the Mandates of assignable_from<T&, ranges​::​range_reference_t<R>> s modeled, however, this is missed in the MSVC-STL implementation.

The following should be rejected:

#include <vector>
 
struct Int {
  void operator=(int);
  Int(int);
};

int main() {
  std::vector<Int> v;
  v.assign_range(std::vector{42}); // only libstdc++ rejects
}

https://godbolt.org/z/TrGsbcndj

Not sure if other containers have similar issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!rangesC++20/23 ranges

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions