1
0
mirror of https://github.com/google/benchmark.git synced 2025-04-29 22:40:33 +08:00

Fixture: add non const Setup() and TearDown(). ()

* 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:
biojppm 2016-09-01 18:51:48 +01:00 committed by Dominic Hamon
parent 83561f0580
commit 6a28f1e968

View File

@ -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;