3

It is said that the injection of the Ranges TS into the std namespace would cause a number of breaking changes to the standard library (e.g. this link). Does anybody know what those changes are?

4

1 回答 1

4

From N4569 Annex B (as linked by @Holt in the comments above):

  • Algorithm Return Types -- modified to include the end iterator

  • Stronger Constraints -- algorithms that used to require just < now require all comparison operators

  • Constrained Functional Objects -- Constraints added to std::less's type and the like.

  • Iterators and Default-Constructibility -- Ranges_v3 assumes iterators can be default constructed (in a useful way). This is not currently required.

  • iterator_traits cannot be specialized -- in Range_v3, it is an alias template.

  • N3351 -- it is also incompatible with the N3351 proposal in a number of ways, which I won't get into here.

This is just a summary. Follow the link to the paper or find it for more details.

于 2016-11-30T21:14:59.437 回答