102 template<
typename DataModel>
103 void invokeSetWithEachArgument(DataModel && )
108 template<
typename DataModel,
typename Arg,
typename... Args>
109 void invokeSetWithEachArgument(DataModel &&dm, Arg &&arg, Args &&...args)
111 dm.set(std::forward<Arg>(arg));
112 invokeSetWithEachArgument(std::forward<DataModel>(dm), std::forward<Args>(args)...);
121 static_assert(std::is_default_constructible<T>::value,
"T needs to be default_constructible");
125 : m_hasValue{
false }
129 explicit constexpr Optional(
const T &value)
134 explicit constexpr Optional(T &&value)
136 , m_value{ std::move(value) }
139 const T &value()
const
143 throw std::runtime_error(
"value() called on unset optional");
148 bool hasValue()
const
159 bool operator==(
const Optional<T> &other)
const
161 if(hasValue() != other.hasValue())
169 return value() == other.value();
172 bool operator!=(
const Optional<T> &other)
const
174 return !operator==(other);
177 bool operator<(
const Optional<T> &other)
const
179 if(!hasValue() && !other.hasValue())
183 if(hasValue() && !other.hasValue())
187 if(!hasValue() && other.hasValue())
191 return m_value < other.m_value;
194 bool operator>(
const Optional<T> &other)
const
196 if(!hasValue() && !other.hasValue())
200 if(hasValue() && !other.hasValue())
204 if(!hasValue() && other.hasValue())
208 return m_value > other.m_value;
219 static void setFromString(T &target,
const std::string &value)
221 target.setFromString(value);
224 static void setFromString(T &target,
const std::string &path,
const std::string &value)
226 target.setFromString(path, value);
229 static std::string getString(
const T &target,
const std::string &path)
231 return target.getString(path);
236 void setFromString(T &target,
const std::string &value)
238 Befriend<T>::setFromString(target, value);
242 void setFromString(T &target,
const std::string &path,
const std::string &value)
244 Befriend<T>::setFromString(target, path, value);
248 std::string getString(
const T &target,
const std::string &path)
250 return Befriend<T>::getString(target, path);
The main Zivid namespace. All Zivid code is found here
Definition: Application.h:99