remove_if.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2018 Kohei Takahashi
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(FUSION_REMOVE_IF_07162005_0818)
  8. #define FUSION_REMOVE_IF_07162005_0818
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/view/filter_view/filter_view.hpp>
  11. #include <boost/mpl/not.hpp>
  12. namespace boost { namespace fusion
  13. {
  14. namespace result_of
  15. {
  16. template <typename Sequence, typename Pred>
  17. struct remove_if
  18. {
  19. typedef filter_view<Sequence, mpl::not_<Pred> > type;
  20. };
  21. }
  22. template <typename Pred, typename Sequence>
  23. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  24. inline typename result_of::remove_if<Sequence const, Pred>::type
  25. remove_if(Sequence const& seq)
  26. {
  27. typedef typename result_of::remove_if<Sequence const, Pred>::type result_type;
  28. return result_type(seq);
  29. }
  30. }}
  31. #endif