filter_if.hpp 1.0 KB

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