| 1 | /*============================================================================= |
|---|---|
| 2 | Copyright (c) 2001-2011 Joel de Guzman |
| 3 | |
| 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_ERASE_KEY_10022005_1851) |
| 8 | #define FUSION_ERASE_KEY_10022005_1851 |
| 9 | |
| 10 | #include <boost/fusion/support/config.hpp> |
| 11 | #include <boost/fusion/algorithm/query/find.hpp> |
| 12 | #include <boost/fusion/algorithm/transformation/erase.hpp> |
| 13 | #include <boost/mpl/not.hpp> |
| 14 | #include <boost/type_traits/is_same.hpp> |
| 15 | |
| 16 | namespace boost { namespace fusion |
| 17 | { |
| 18 | namespace result_of |
| 19 | { |
| 20 | template <typename Sequence, typename Key> |
| 21 | struct erase_key |
| 22 | : erase<Sequence, typename find<Sequence, Key>::type> |
| 23 | {}; |
| 24 | } |
| 25 | |
| 26 | template <typename Key, typename Sequence> |
| 27 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 28 | inline typename result_of::erase_key<Sequence const, Key>::type |
| 29 | erase_key(Sequence const& seq) |
| 30 | { |
| 31 | return erase(seq, find<Key>(seq)); |
| 32 | } |
| 33 | }} |
| 34 | |
| 35 | #endif |
| 36 | |
| 37 |
