Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-12-23 21:22:32 +0100
committerMartin Hořeňovský2020-02-13 16:26:06 +0100
commit0f47fe16bdfc4546b1952da34e809388565f93c0 (patch)
treeb23ca6ee917f05396a4fc0b1914eaab92bbb6c74
parent82baef62e2cc6766915e2278309e41cab514f53d (diff)
downloadcatch3-0f47fe16bdfc4546b1952da34e809388565f93c0.tar.gz
Provide const overload of ObjectStorage::stored_object()
Fixes #1820
-rw-r--r--src/catch2/benchmark/catch_constructor.hpp8
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