103 template<
typename DataModel>
104 void invokeSetWithEachArgument(DataModel && )
109 template<
typename DataModel,
typename Arg,
typename... Args>
110 void invokeSetWithEachArgument(DataModel &&dm, Arg &&arg, Args &&...args)
112 dm.set(std::forward<Arg>(arg));
113 invokeSetWithEachArgument(std::forward<DataModel>(dm), std::forward<Args>(args)...);
122 static_assert(std::is_default_constructible<T>::value,
"T needs to be default_constructible");
126 : m_hasValue{
false }
130 explicit constexpr Optional(
const T &value)
135 explicit constexpr Optional(T &&value)
137 , m_value{ std::move(value) }
140 const T &value()
const
144 throw std::runtime_error(
"value() called on unset optional");
149 bool hasValue()
const
160 bool operator==(
const Optional<T> &other)
const
162 if(hasValue() != other.hasValue())
170 return value() == other.value();
173 bool operator!=(
const Optional<T> &other)
const
175 return !operator==(other);
178 bool operator<(
const Optional<T> &other)
const
180 if(!hasValue() && !other.hasValue())
184 if(hasValue() && !other.hasValue())
188 if(!hasValue() && other.hasValue())
192 return m_value < other.m_value;
195 bool operator>(
const Optional<T> &other)
const
197 if(!hasValue() && !other.hasValue())
201 if(hasValue() && !other.hasValue())
205 if(!hasValue() && other.hasValue())
209 return m_value > other.m_value;
220 static void setFromString(T &target,
const std::string &value)
222 target.setFromString(value);
225 static void setFromString(T &target,
const std::string &path,
const std::string &value)
227 target.setFromString(path, value);
230 static std::string getString(
const T &target,
const std::string &path)
232 return target.getString(path);
237 void setFromString(T &target,
const std::string &value)
239 Befriend<T>::setFromString(target, value);
243 void setFromString(T &target,
const std::string &path,
const std::string &value)
245 Befriend<T>::setFromString(target, path, value);
249 std::string getString(
const T &target,
const std::string &path)
251 return Befriend<T>::getString(target, path);
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:99