1
0
forked from boostorg/mp11

Fix function application in mp_map_update

This commit is contained in:
Peter Dimov
2017-03-14 22:40:47 +02:00
parent 6fb4cee7b2
commit 5a4fb7f832
2 changed files with 3 additions and 7 deletions

View File

@@ -53,12 +53,8 @@ template<class M, class T, template<class...> class F> struct mp_map_update_impl
{ {
template<class U> using _f = std::is_same<mp_first<T>, mp_first<U>>; template<class U> using _f = std::is_same<mp_first<T>, mp_first<U>>;
// _f2<L<X, Y...>> -> F<Y...> // _f3<L<X, Y...>> -> L<X, F<X, Y...>>
// _f2<pair<X, Y>> -> F<Y> template<class L> using _f3 = mp_assign<L, mp_list<mp_first<L>, mp_rename<L, F>>>;
template<class L> using _f2 = mp_rename<mp_rest<mp_rename<L, mp_list>>, F>;
// _f3<L<X, Y...>> -> L<X, F<Y...>>
template<class L> using _f3 = mp_assign<L, mp_list<mp_first<L>, _f2<L>>>;
using type = mp_if< mp_map_contains<M, mp_first<T>>, mp_transform_if<_f, _f3, M>, mp_push_back<M, T> >; using type = mp_if< mp_map_contains<M, mp_first<T>>, mp_transform_if<_f, _f3, M>, mp_push_back<M, T> >;
}; };

View File

@@ -17,7 +17,7 @@
using boost::mp_int; using boost::mp_int;
template<class T> using inc = mp_int<T::value + 1>; template<class T, class U> using inc = mp_int<U::value + 1>;
int main() int main()
{ {