Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:15

0001 // Boost.Range library
0002 //
0003 //  Copyright Neil Groves 2009. Use, modification and
0004 //  distribution is subject to the Boost Software License, Version
0005 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // For more information, see http://www.boost.org/libs/range/
0009 //
0010 #ifndef BOOST_RANGE_ALGORITHM_EXT_FOR_EACH_HPP_INCLUDED
0011 #define BOOST_RANGE_ALGORITHM_EXT_FOR_EACH_HPP_INCLUDED
0012 
0013 #include <boost/range/config.hpp>
0014 #include <boost/range/concepts.hpp>
0015 #include <boost/range/difference_type.hpp>
0016 #include <boost/range/begin.hpp>
0017 #include <boost/range/end.hpp>
0018 #include <boost/assert.hpp>
0019 
0020 namespace boost
0021 {
0022     namespace range_detail
0023     {
0024         template<class InputIterator1, class InputIterator2, class Fn2>
0025         inline Fn2 for_each_impl(InputIterator1 first1, InputIterator1 last1,
0026                                  InputIterator2 first2, InputIterator2 last2,
0027                                  Fn2 fn)
0028         {
0029             for (; first1 != last1 && first2 != last2; ++first1, ++first2)
0030             {
0031                 fn(*first1, *first2);
0032             }
0033             return fn;
0034         }
0035     }
0036 
0037     namespace range
0038     {
0039         template<class SinglePassRange1, class SinglePassRange2, class Fn2>
0040         inline Fn2 for_each(const SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn)
0041         {
0042             BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0043             BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0044 
0045             return ::boost::range_detail::for_each_impl(
0046                 ::boost::begin(rng1), ::boost::end(rng1),
0047                 ::boost::begin(rng2), ::boost::end(rng2), fn);
0048         }
0049 
0050         template<class SinglePassRange1, class SinglePassRange2, class Fn2>
0051         inline Fn2 for_each(const SinglePassRange1& rng1, SinglePassRange2& rng2, Fn2 fn)
0052         {
0053             BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0054             BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
0055 
0056             return ::boost::range_detail::for_each_impl(
0057                 ::boost::begin(rng1), ::boost::end(rng1),
0058                 ::boost::begin(rng2), ::boost::end(rng2), fn);
0059         }
0060 
0061         template<class SinglePassRange1, class SinglePassRange2, class Fn2>
0062         inline Fn2 for_each(SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn)
0063         {
0064             BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
0065             BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0066 
0067             return ::boost::range_detail::for_each_impl(
0068                 ::boost::begin(rng1), ::boost::end(rng1),
0069                 ::boost::begin(rng2), ::boost::end(rng2), fn);
0070         }
0071 
0072         template<class SinglePassRange1, class SinglePassRange2, class Fn2>
0073         inline Fn2 for_each(SinglePassRange1& rng1, SinglePassRange2& rng2, Fn2 fn)
0074         {
0075             BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
0076             BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
0077 
0078             return ::boost::range_detail::for_each_impl(
0079                 ::boost::begin(rng1), ::boost::end(rng1),
0080                 ::boost::begin(rng2), ::boost::end(rng2), fn);
0081         }
0082     } // namespace range
0083     using range::for_each;
0084 } // namespace boost
0085 
0086 #endif // include guard