Provide const overload of ObjectStorage::stored_object()

Fixes #1820
This commit is contained in:
Martin Hořeňovský 2019-12-23 21:22:32 +01:00
parent 6c9a255dc2
commit e4004e0adb
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

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