16#ifndef dealii_base_mutable_bind_h
17#define dealii_base_mutable_bind_h
81 template <
typename ReturnType,
class... FunctionArgs>
89 using TupleType = std::tuple<
typename std::remove_cv<
90 typename std::remove_reference<FunctionArgs>::type>::type...>;
96 template <
class FunctionType>
103 template <
class FunctionType>
110 template <
class FunctionType>
156 const std::function<ReturnType(FunctionArgs...)>
function;
186 template <
typename ReturnType,
class... FunctionArgs>
194 template <
typename ReturnType,
class... FunctionArgs>
209 template <
typename ReturnType,
class... FunctionArgs>
216 template <
typename ReturnType,
class... FunctionArgs>
223 template <
typename ReturnType,
class... FunctionArgs>
224 template <
class FunctionType>
226 FunctionType function,
227 FunctionArgs &&... arguments)
229 , arguments(
std::make_tuple(
std::move(arguments)...))
234 template <
typename ReturnType,
class... FunctionArgs>
235 template <
class FunctionType>
236 MutableBind<ReturnType, FunctionArgs...>::MutableBind(FunctionType function,
237 TupleType && arguments)
239 , arguments(
std::move(arguments))
244 template <
typename ReturnType,
class... FunctionArgs>
245 template <
class FunctionType>
246 MutableBind<ReturnType, FunctionArgs...>::MutableBind(FunctionType function)
252 template <
typename ReturnType,
class... FunctionArgs>
254 MutableBind<ReturnType, FunctionArgs...>::operator()()
const
256 return std_cxx17::apply(function, arguments);
261 template <
typename ReturnType,
class... FunctionArgs>
263 MutableBind<ReturnType, FunctionArgs...>::set_arguments(
264 FunctionArgs &&... args)
266 arguments = std::make_tuple(std::move(args)...);
271 template <
typename ReturnType,
class... FunctionArgs>
273 MutableBind<ReturnType, FunctionArgs...>::set_arguments(TupleType &&args)
275 arguments = std::move(args);
280 template <
typename ReturnType,
class... FunctionArgs>
282 MutableBind<ReturnType, FunctionArgs...>::parse_arguments(
283 const std::string & value_string,
292 template <
typename ReturnType,
class... FunctionArgs>
293 MutableBind<ReturnType, FunctionArgs...>
297 return MutableBind<ReturnType, FunctionArgs...>(function,
298 std::move(arguments)...);
303 template <
typename ReturnType,
class... FunctionArgs>
304 MutableBind<ReturnType, FunctionArgs...>
307 return MutableBind<ReturnType, FunctionArgs...>(function);
312 template <
typename ReturnType,
class... FunctionArgs>
313 MutableBind<ReturnType, FunctionArgs...>
314 mutable_bind(std::function<ReturnType(FunctionArgs...)> function,
317 return MutableBind<ReturnType, FunctionArgs...>(function,
318 std::move(arguments)...);
323 template <
typename ReturnType,
class... FunctionArgs>
324 MutableBind<ReturnType, FunctionArgs...>
325 mutable_bind(std::function<ReturnType(FunctionArgs...)> function)
327 return MutableBind<ReturnType, FunctionArgs...>(function);
std::tuple< typename std::remove_cv< typename std::remove_reference< FunctionArgs >::type >::type... > TupleType
MutableBind(FunctionType function, FunctionArgs &&... arguments)
ReturnType operator()() const
MutableBind(FunctionType function)
void set_arguments(FunctionArgs &&... arguments)
MutableBind(FunctionType function, TupleType &&arguments)
const std::function< ReturnType(FunctionArgs...)> function
void set_arguments(TupleType &&arguments)
void parse_arguments(const std::string &value_string, const Patterns::PatternBase &pattern= *Patterns::Tools::Convert< TupleType >::to_pattern())
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static T to_value(const std::string &s, const Patterns::PatternBase &p= *Convert< T >::to_pattern())=delete
MutableBind< ReturnType, FunctionArgs... > mutable_bind(std::function< ReturnType(FunctionArgs...)>)
MutableBind< ReturnType, FunctionArgs... > mutable_bind(ReturnType(*function)(FunctionArgs...), typename identity< FunctionArgs >::type &&... arguments)