| | |
| | | #include <string> |
| | | #include <vector> |
| | | #include <functional> |
| | | #include <algorithm> |
| | | #include "apply_tuple.h" |
| | | |
| | | #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) |
| | |
| | | typedef bool result_type; |
| | | result_type operator()(F&& f, arg_type&& v) |
| | | { |
| | | apply_tuple(std::forward<F>(f), std::forward<arg_type>(v)); |
| | | qtl::detail::apply_tuple(std::forward<F>(f), std::forward<arg_type>(v)); |
| | | return true; |
| | | } |
| | | }; |
| | |
| | | typedef Ret result_type; |
| | | result_type operator()(F&& f, arg_type&& v) |
| | | { |
| | | return apply_tuple(std::forward<F>(f), std::forward<arg_type>(v)); |
| | | return qtl::detail::apply_tuple(std::forward<F>(f), std::forward<arg_type>(v)); |
| | | } |
| | | }; |
| | | |
| | |
| | | typedef decltype(values) values_type; |
| | | while(command.fetch(std::forward<values_type>(values))) |
| | | { |
| | | if(!detail::apply(std::forward<ValueProc>(proc), std::forward<values_type>(values))) |
| | | if(!apply(std::forward<ValueProc>(proc), std::forward<values_type>(values))) |
| | | break; |
| | | } |
| | | } |
| | |
| | | template<typename Command, typename T> |
| | | struct params_binder |
| | | { |
| | | enum { size = 1 }; |
| | | inline void operator()(Command& command, const T& param) const |
| | | { |
| | | qtl::bind_param(command, 0, param); |
| | |
| | | template<typename Command, typename... Types> |
| | | struct params_binder<Command, std::tuple<Types...>> |
| | | { |
| | | enum { size = sizeof...(Types) }; |
| | | void operator()(Command& command, const std::tuple<Types...>& params) const |
| | | { |
| | | (detail::bind_helper<Command, std::tuple_size<std::tuple<Types...>>::value, Types...>(command))(params); |
| | |
| | | template<typename Command, typename Type1, typename Type2> |
| | | struct params_binder<Command, std::pair<Type1, Type2>> |
| | | { |
| | | enum { size = 2 }; |
| | | void operator()(Command& command, std::pair<Type1, Type2>&& values) const |
| | | { |
| | | qtl::bind_param(command, 0, std::forward<Type1>(values.first)); |