/*============================================================================= Copyright (c) 2003 Joel de Guzman Copyright (c) 2004 Peder Holt Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_SEQUENCE_AS_FUSION_ITERATOR_HPP) #define FUSION_SEQUENCE_AS_FUSION_ITERATOR_HPP #include #include #include #include namespace boost { namespace fusion { // Test T. If it is a fusion iterator, return a reference to it. // else, assume it is an mpl iterator. namespace as_fusion_iterator_detail { template static T const& convert(T const& x, mpl::true_) { return x; } template static type_sequence_iterator convert(T const& x, mpl::false_) { return type_sequence_iterator(); } } template struct as_fusion_iterator { typedef typename mpl::if_< fusion::is_iterator , T , type_sequence_iterator >::type type; static typename mpl::if_< fusion::is_iterator , T const& , type_sequence_iterator >::type convert(T const& x); }; template typename mpl::if_< fusion::is_iterator , T const& , type_sequence_iterator >::type as_fusion_iterator::convert(T const& x) { return as_fusion_iterator_detail::convert(x, fusion::is_iterator()); } }} #endif