/*============================================================================= 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_ITERATOR_DEREF_HPP) #define FUSION_ITERATOR_DEREF_HPP #include #include #include #include #include namespace boost { namespace fusion { namespace meta { template struct deref_impl { template struct apply {}; }; template struct deref { typedef as_fusion_iterator converter; typedef typename converter::type iter; typedef typename deref_impl:: template apply::type type; }; } namespace deref_detail { template typename meta::deref::type deref(Iterator const& i,mpl::true_) { typedef as_fusion_iterator converter; typedef typename converter::type iter; typename meta::deref::type result = meta::deref_impl:: template apply::call(converter::convert(i)); return result; } template inline typename meta::deref::type deref(Iterator& i,mpl::false_) { typedef as_fusion_iterator converter; typedef typename converter::type iter; typename meta::deref::type result = meta::deref_impl:: template apply::call(converter::convert(i)); return result; } } template typename meta::deref::type deref(Iterator& i) { return deref_detail::deref(i,is_const()); } template typename meta::deref::type deref(Iterator const & i) { return deref_detail::deref(i,is_const()); } template typename meta::deref::type operator*(iterator_base const& i) { return fusion::deref(i.cast()); } template inline typename meta::deref::type operator*(iterator_base& i) { return fusion::deref(i.cast()); } // Note: VC7.1 has a problem when we pass the return value directly. // Try removing the named temporary. This only happens on debug builds. // It seems to be a return value optimization bug. }} #endif