diff options
| author | Martin Hořeňovský | 2019-12-23 21:22:32 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-02-13 16:26:06 +0100 |
| commit | 0f47fe16bdfc4546b1952da34e809388565f93c0 (patch) | |
| tree | b23ca6ee917f05396a4fc0b1914eaab92bbb6c74 /src/catch2 | |
| parent | 82baef62e2cc6766915e2278309e41cab514f53d (diff) | |
| download | catch3-0f47fe16bdfc4546b1952da34e809388565f93c0.tar.gz | |
Provide const overload of ObjectStorage::stored_object()
Fixes #1820
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/benchmark/catch_constructor.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/catch2/benchmark/catch_constructor.hpp b/src/catch2/benchmark/catch_constructor.hpp index f12958f3..936a7467 100644 --- a/src/catch2/benchmark/catch_constructor.hpp +++ b/src/catch2/benchmark/catch_constructor.hpp @@ -55,11 +55,15 @@ namespace Catch { template <typename U> void destruct_on_exit(typename std::enable_if<!Destruct, U>::type* = 0) { } - T& stored_object() - { + T& stored_object() { return *static_cast<T*>(static_cast<void*>(&data)); } + T const& stored_object() const { + return *static_cast<T*>(static_cast<void*>(&data)); + } + + TStorage data; }; } // namespace Detail |