diff --git a/include/boost/fusion/sequence/view/iterator_range/detail/at_impl.hpp b/include/boost/fusion/sequence/view/iterator_range/detail/at_impl.hpp new file mode 100644 index 00000000..5f882aaa --- /dev/null +++ b/include/boost/fusion/sequence/view/iterator_range/detail/at_impl.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 2007 Tobias Schwinger + + Distributed under 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(BOOST_FUSION_ITERATOR_RANGE_AT_IMPL_HPP_INCLUDED) +#define BOOST_FUSION_ITERATOR_RANGE_AT_IMPL_HPP_INCLUDED + +#include +#include + +namespace boost { namespace fusion +{ + struct iterator_range_tag; + + namespace extension + { + template + struct at_impl; + + template <> + struct at_impl + { + template + struct apply + { + typedef typename Seq::begin_type begin_type; + typedef typename result_of::advance::type pos; + typedef typename result_of::deref::type type; + + static type + call(Seq& s) + { + return * advance(s.first); + } + }; + }; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/view/iterator_range/detail/value_at_impl.hpp b/include/boost/fusion/sequence/view/iterator_range/detail/value_at_impl.hpp new file mode 100644 index 00000000..b6fe8881 --- /dev/null +++ b/include/boost/fusion/sequence/view/iterator_range/detail/value_at_impl.hpp @@ -0,0 +1,38 @@ +/*============================================================================= + Copyright (c) 2007 Tobias Schwinger + + Distributed under 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(BOOST_FUSION_ITERATOR_RANGE_VALUE_AT_IMPL_HPP_INCLUDED) +#define BOOST_FUSION_ITERATOR_RANGE_VALUE_AT_IMPL_HPP_INCLUDED + +#include +#include + +namespace boost { namespace fusion +{ + struct iterator_range_tag; + + namespace extension + { + template + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply + { + typedef typename Seq::begin_type begin_type; + typedef typename result_of::advance::type pos; + typedef typename result_of::value_of::type type; + }; + }; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/view/iterator_range/iterator_range.hpp b/include/boost/fusion/sequence/view/iterator_range/iterator_range.hpp index dd9eae8f..dee6c00a 100644 --- a/include/boost/fusion/sequence/view/iterator_range/iterator_range.hpp +++ b/include/boost/fusion/sequence/view/iterator_range/iterator_range.hpp @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #include #include @@ -31,9 +33,7 @@ namespace boost { namespace fusion typedef typename result_of::distance::type size; typedef mpl::true_ is_view; - typedef forward_traversal_tag category; - // typedef typename traits::category_of::type category; - // TODO: make it work - tosh + typedef typename traits::category_of::type category; iterator_range(First const& first, Last const& last) : first(convert_iterator::call(first))