Commit 1880497d authored by Dominik Charousset's avatar Dominik Charousset

fix for patterns with `on(any_vals, arg_match)`

this patch fixes the pattern matching implementation of libcppa
to create correct value gards when using `on(any_vals, arg_match)`
parent 74649973
...@@ -55,7 +55,12 @@ struct vg_fwd_<true, T> { ...@@ -55,7 +55,12 @@ struct vg_fwd_<true, T> {
static inline util::void_type _(Arg&&) { return {}; } static inline util::void_type _(Arg&&) { return {}; }
}; };
// absorbs callables template<>
struct vg_fwd_<false,anything> {
static inline util::void_type _(const anything&) { return {}; }
};
// absorbs callables and instances of `anything`
template<typename T> template<typename T>
struct vg_fwd struct vg_fwd
: vg_fwd_<util::is_callable<typename util::rm_ref<T>::type>::value, : vg_fwd_<util::is_callable<typename util::rm_ref<T>::type>::value,
...@@ -87,8 +92,7 @@ class value_guard { ...@@ -87,8 +92,7 @@ class value_guard {
value_guard(const value_guard&) = default; value_guard(const value_guard&) = default;
template<typename... Args> template<typename... Args>
value_guard(const Args&... args) : m_args(vg_fwd<Args>::_(args)...) { value_guard(const Args&... args) : m_args(vg_fwd<Args>::_(args)...) { }
}
template<typename... Args> template<typename... Args>
inline bool operator()(const Args&... args) const { inline bool operator()(const Args&... args) const {
......
...@@ -296,12 +296,15 @@ constexpr boxed_arg_match_t arg_match = boxed_arg_match_t(); ...@@ -296,12 +296,15 @@ constexpr boxed_arg_match_t arg_match = boxed_arg_match_t();
template<typename Arg0, typename... Args> template<typename Arg0, typename... Args>
detail::rvalue_builder< detail::rvalue_builder<
detail::value_guard< detail::value_guard<
typename util::tl_trim< typename util::tl_filter_not<
typename util::tl_map< typename util::tl_trim<
util::type_list<Arg0, Args...>, typename util::tl_map<
detail::boxed_and_callable_to_void, util::type_list<Arg0, Args...>,
detail::implicit_conversions detail::boxed_and_callable_to_void,
>::type detail::implicit_conversions
>::type
>::type,
is_anything
>::type >::type
>, >,
typename util::tl_map< typename util::tl_map<
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment