-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fixture: add non const Setup() and TearDown(). #285
Conversation
This allows write-access to the State variable, which is important in upcoming user-defined counter functionality.
✅ Build benchmark 403 completed (commit 593e40b416 by @jppm) |
virtual void SetUp(const State&) {} | ||
virtual void TearDown(const State&) {} | ||
// ... In favor of these. | ||
virtual void SetUp(State& st) { SetUp(static_cast<State const&>(st)); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be consistent wrt the placement of const
. This library generally puts it before the type name. (I am in the "after the type name" camp, but consistency trumps.)
✅ Build benchmark 405 completed (commit 99e137a332 by @jppm) |
virtual void SetUp(const State&) {} | ||
virtual void TearDown(const State&) {} | ||
// ... In favor of these. | ||
virtual void SetUp(State& st) { SetUp(static_cast<const State&>(st)); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const_cast, probably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah this should be static_cast. const_cast is for removing const.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gah, completely read it wrong. i thought it was the other way around (with the old ones forwarding to the new ones)
✅ Build benchmark 407 completed (commit 44c8fdda78 by @jppm) |
Const SetUp and TearDown were deprecated in google#285
Const SetUp and TearDown were deprecated in #285 Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
This allows write-access to the State argument, which is important in upcoming user-defined counter functionality.