Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page 241 has wrong definition and usage of sort_concept #37

Open
Ukilele opened this issue May 16, 2022 · 0 comments
Open

Page 241 has wrong definition and usage of sort_concept #37

Ukilele opened this issue May 16, 2022 · 0 comments

Comments

@Ukilele
Copy link

Ukilele commented May 16, 2022

On page 241 is following concept defined:

template <typename R, typename T , typename U>
concept sort_concept = std::equality_comparable<T, U>
and std::copy_constructible<T>
and std::incrementable<T>
and std::indirectly_readable<T>
and std::swappable<T>
and std::strict_weak_order<R, T, U>;

(Side note: The space in T , appears also in the book.)

Afterwards, following function is defined:

void sort(sort_concept auto begin, sort_concept auto end);
  1. Regarding sort_concept:
  • std::equality_comparable only has one template parameter. Did you intent to use std::equality_comparable_with<T, U> or maybe sentinel_for<T, U>?
  • Shouldn't you use std::indirect_strict_weak_order<R, T, U> instead of std::strict_weak_order<R, T, U>?
  • Why is it templated of both T and U? Wasn't there only one InIt on page 240 that we write this concept for?
  1. The use of sort_concept auto in the definition of void sort(...) wont compile. The concept takes three arguments, but we only (implicitly) provide one argument.

Label: 4.6: T.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant