mirror of
https://github.com/google/benchmark.git
synced 2025-04-29 22:40:33 +08:00
Fixture: add non const Setup() and TearDown(). (#285)
* Fixture: add non const Setup() and TearDown(). This allows write-access to the State variable, which is important in upcoming user-defined counter functionality. * Fix const placement in the Fixture methods. * Fixture: use const_cast instead of static_cast.
This commit is contained in:
parent
83561f0580
commit
6a28f1e968
@ -709,8 +709,12 @@ public:
|
||||
this->TearDown(st);
|
||||
}
|
||||
|
||||
// These will be deprecated ...
|
||||
virtual void SetUp(const State&) {}
|
||||
virtual void TearDown(const State&) {}
|
||||
// ... In favor of these.
|
||||
virtual void SetUp(State& st) { SetUp(const_cast<const State&>(st)); }
|
||||
virtual void TearDown(State& st) { TearDown(const_cast<const State&>(st)); }
|
||||
|
||||
protected:
|
||||
virtual void BenchmarkCase(State&) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user