mirror of
https://github.com/boostorg/mp11.git
synced 2025-12-06 08:29:23 +01:00
Add mp_transform_if, mp_map_update
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef BOOST_MP11_ALGORITHM_HPP_INCLUDED
|
||||
#define BOOST_MP11_ALGORITHM_HPP_INCLUDED
|
||||
|
||||
// Copyright 2015, 2016 Peter Dimov.
|
||||
// Copyright 2015-2017 Peter Dimov.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
//
|
||||
@@ -69,6 +69,31 @@ template<template<class...> class F, template<class...> class L1, class... T1, t
|
||||
|
||||
template<template<class...> class F, class... L> using mp_transform = typename detail::mp_transform_impl<F, L...>::type;
|
||||
|
||||
// mp_transform_if<P, F, L>
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<template<class...> class P, template<class...> class F, class L> struct mp_transform_if_impl;
|
||||
|
||||
template<template<class...> class P, template<class...> class F, template<class...> class L, class... T> struct mp_transform_if_impl<P, F, L<T...>>
|
||||
{
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1910 )
|
||||
|
||||
template<class U> struct _f { using type = mp_eval_if<mp_not<P<U>>, U, F, U>; };
|
||||
using type = L<typename _f<T>::type...>;
|
||||
|
||||
#else
|
||||
|
||||
template<class U> using _f = mp_eval_if<mp_not<P<U>>, U, F, U>;
|
||||
using type = L<_f<T>...>;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<template<class...> class P, template<class...> class F, class L> using mp_transform_if = typename detail::mp_transform_if_impl<P, F, L>::type;
|
||||
|
||||
// mp_fill<L, V>
|
||||
namespace detail
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user