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

[sap] Use C++20 'requires' syntax for double-only functions #21440

Merged

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented May 16, 2024

This change is Reviewable

@jwnimmer-tri jwnimmer-tri added priority: low release notes: none This pull request should not be mentioned in the release notes labels May 16, 2024
@jwnimmer-tri jwnimmer-tri changed the title [sap] Use new C++20 'requires' syntax for double-only functions [sap] Use C++20 'requires' syntax for double-only functions May 16, 2024
Copy link
Contributor

@amcastro-tri amcastro-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @jwnimmer-tri! this is definitely a useful C++20 fature, making the intetion very clear.
:lgtm_strong:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: 1 unresolved discussion, needs platform reviewer assigned, needs at least two assigned reviewers


multibody/contact_solvers/sap/sap_solver.h line 306 at r1 (raw file):

  // @pre context is not nullptr.
  // @pre context was created via a call to model.MakeContext().
  SapSolverStatus SolveWithGuessImpl(const SapModel<T>& model,

btw, I like this function name change!

@amcastro-tri amcastro-tri self-assigned this May 16, 2024
Copy link
Contributor

@amcastro-tri amcastro-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding myself +@amcastro-tri for feature review

Reviewable status: 1 unresolved discussion, needs platform reviewer assigned, needs at least two assigned reviewers

Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 unresolved discussion, needs platform reviewer assigned, needs at least two assigned reviewers


multibody/contact_solvers/sap/sap_solver.cc line 218 at r1 (raw file):

                                                 systems::Context<T>* context)
  requires std::is_same_v<T, double>
{  // NOLINT(whitespace/braces)

BTW What's the story with this linting directive? Is this going to have to be part of every incantation that uses requires?

Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 unresolved discussion, needs platform reviewer assigned, needs at least two assigned reviewers


multibody/contact_solvers/sap/sap_solver.cc line 218 at r1 (raw file):

Previously, SeanCurtis-TRI (Sean Curtis) wrote…

BTW What's the story with this linting directive? Is this going to have to be part of every incantation that uses requires?

As of today, yes. The medium-term goal is to either:

(1) Change our linters so that when enable_clang_format_lint = True, the whitespace/* rules in CPPLINT are disarmed, or

(2) Upgrade to a newer cpplint that understands requires.

@jwnimmer-tri
Copy link
Collaborator Author

FYI We'll give this until my afternoon time for any platform reviewers to raise objections (per my slack post), but then we can merge it.

Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:LGTM:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees amcastro-tri,SeanCurtis-TRI(platform)

@amcastro-tri amcastro-tri merged commit 7508355 into RobotLocomotion:master May 20, 2024
10 checks passed
@jwnimmer-tri jwnimmer-tri deleted the sap-cxx20-requires branch May 20, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low release notes: none This pull request should not be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants