libstdc++: Constrain move_iterator default constructor
libstdc++ constrains std::move_iterator's default constructor to require default_initializable iterators when concepts are enabled.
This commit implements LWG4125 by constraining the default constructor of std::move_iterator in libstdc++. When C++20 concepts are enabled, this constructor now requires that the underlying iterator type be default-initializable. This change enhances type safety and adheres to the C++ standard library requirements.
In Details
The default constructor of std::move_iterator in libstdc++ has been constrained to require default_initializable for its underlying iterator type, aligning with LWG 4125. This constraint is applied when C++20 concepts are enabled (__glibcxx_concepts). This change ensures type safety and adherence to modern C++ standard library requirements.
- libstdc++
- The GNU implementation of the C++ Standard Library.
- std::move_iterator
- An iterator adaptor that treats dereferencing as a move operation.
- default constructor
- A constructor that can be called with no arguments.
- constrained constructor
- A constructor that has additional requirements on its template parameters, enforced by concepts or SFINAE.
- LWG4125
- A Library Working Group (LWG) issue for the C++ standard, specifying a change to the
move_iterator's default constructor. - concepts
- A C++20 feature that allows specifying requirements on template parameters.
- default_initializable
- A C++ concept that checks if a type can be default-initialized.