erase_key.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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_ERASE_KEY_10022005_1851)
  7. #define FUSION_ERASE_KEY_10022005_1851
  8. #include <boost/fusion/support/config.hpp>
  9. #include <boost/fusion/algorithm/query/find.hpp>
  10. #include <boost/fusion/algorithm/transformation/erase.hpp>
  11. #include <boost/mpl/not.hpp>
  12. #include <boost/type_traits/is_same.hpp>
  13. namespace boost { namespace fusion
  14. {
  15. namespace result_of
  16. {
  17. template <typename Sequence, typename Key>
  18. struct erase_key
  19. : erase<Sequence, typename find<Sequence, Key>::type>
  20. {};
  21. }
  22. template <typename Key, typename Sequence>
  23. BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
  24. inline typename result_of::erase_key<Sequence const, Key>::type
  25. erase_key(Sequence const& seq)
  26. {
  27. return erase(seq, find<Key>(seq));
  28. }
  29. }}
  30. #endif