28 #ifndef OPM_CONDITIONAL_STORAGE_HH
29 #define OPM_CONDITIONAL_STORAGE_HH
44 template <
bool cond,
class T>
49 static constexpr
bool condition = cond;
62 template <
class ...Args>
72 : data_(std::move(t.data_))
83 data_ = std::move(v.data_);
87 const T& operator*()
const
92 const T* operator->()
const
106 static constexpr
bool condition =
false;
112 [[maybe_unused]] T dummy;
120 [[maybe_unused]] T dummy(v);
129 template <
class ...Args>
135 [[maybe_unused]] T dummy(args...);
151 const T& operator*()
const
152 {
throw std::logic_error(
"data member deactivated"); }
154 {
throw std::logic_error(
"data member deactivated"); }
156 const T* operator->()
const
157 {
throw std::logic_error(
"data member deactivated"); }
159 {
throw std::logic_error(
"data member deactivated"); }
A simple class which only stores a given member attribute if a boolean condition is true.
Definition: ConditionalStorage.hpp:46