1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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_CONVERT_ITERATOR_05062005_1218)
8 #define FUSION_CONVERT_ITERATOR_05062005_1218
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/support/is_iterator.hpp>
12 #include <boost/mpl/if.hpp>
13 #include <boost/mpl/bool.hpp>
15 namespace boost { namespace fusion
17 template <typename Iterator>
18 struct mpl_iterator; // forward declaration
20 // Test T. If it is a fusion iterator, return a reference to it.
21 // else, assume it is an mpl iterator.
24 struct convert_iterator
34 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
36 call(T const& x, mpl::true_)
41 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
42 static mpl_iterator<T>
43 call(T const& /*x*/, mpl::false_)
45 return mpl_iterator<T>();
48 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
57 return call(x, is_fusion_iterator<T>());