28 #ifndef OPM_CONDITIONAL_STORAGE_HH
29 #define OPM_CONDITIONAL_STORAGE_HH
45 template <
bool cond,
class T>
50 static constexpr
bool condition = cond;
63 template <
class ...Args>
73 : data_(std::move(t.data_))
84 data_ = std::move(v.data_);
88 const T& operator*()
const
93 const T* operator->()
const
107 static constexpr
bool condition =
false;
113 [[maybe_unused]] T dummy;
121 [[maybe_unused]] T dummy(v);
130 template <
class ...Args>
136 [[maybe_unused]] T dummy(args...);
152 const T& operator*()
const
153 {
throw std::logic_error(
"data member deactivated"); }
155 {
throw std::logic_error(
"data member deactivated"); }
157 const T* operator->()
const
158 {
throw std::logic_error(
"data member deactivated"); }
160 {
throw std::logic_error(
"data member deactivated"); }
Provides the OPM_UNUSED macro.
A simple class which only stores a given member attribute if a boolean condition is true.
Definition: ConditionalStorage.hpp:47