annotate DEPENDENCIES/generic/include/boost/range/algorithm_ext/overwrite.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Range library
Chris@16 2 //
Chris@16 3 // Copyright Neil Groves 2009. Use, modification and
Chris@16 4 // distribution is subject to the Boost Software License, Version
Chris@16 5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //
Chris@16 8 // For more information, see http://www.boost.org/libs/range/
Chris@16 9 //
Chris@16 10 #ifndef BOOST_RANGE_ALGORITHM_EXT_OVERWRITE_HPP_INCLUDED
Chris@16 11 #define BOOST_RANGE_ALGORITHM_EXT_OVERWRITE_HPP_INCLUDED
Chris@16 12
Chris@16 13 #include <boost/range/config.hpp>
Chris@16 14 #include <boost/range/concepts.hpp>
Chris@16 15 #include <boost/range/difference_type.hpp>
Chris@16 16 #include <boost/range/iterator.hpp>
Chris@16 17 #include <boost/range/begin.hpp>
Chris@16 18 #include <boost/range/end.hpp>
Chris@16 19 #include <boost/assert.hpp>
Chris@16 20
Chris@16 21 namespace boost
Chris@16 22 {
Chris@16 23 namespace range
Chris@16 24 {
Chris@16 25
Chris@16 26 template< class SinglePassRange1, class SinglePassRange2 >
Chris@16 27 inline void overwrite( const SinglePassRange1& from, SinglePassRange2& to )
Chris@16 28 {
Chris@16 29 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 30 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
Chris@16 31
Chris@16 32 BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type
Chris@16 33 i = boost::begin(from), e = boost::end(from);
Chris@16 34
Chris@16 35 BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange2>::type
Chris@16 36 out = boost::begin(to);
Chris@16 37
Chris@16 38 #ifndef NDEBUG
Chris@16 39 BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange2>::type
Chris@16 40 last_out = boost::end(to);
Chris@16 41 #endif
Chris@16 42
Chris@16 43 for( ; i != e; ++out, ++i )
Chris@16 44 {
Chris@16 45 #ifndef NDEBUG
Chris@16 46 BOOST_ASSERT( out != last_out
Chris@16 47 && "out of bounds in boost::overwrite()" );
Chris@16 48 #endif
Chris@16 49 *out = *i;
Chris@16 50 }
Chris@16 51 }
Chris@16 52
Chris@16 53 template< class SinglePassRange1, class SinglePassRange2 >
Chris@16 54 inline void overwrite( const SinglePassRange1& from, const SinglePassRange2& to )
Chris@16 55 {
Chris@16 56 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 57 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 58
Chris@16 59 BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type
Chris@16 60 i = boost::begin(from), e = boost::end(from);
Chris@16 61
Chris@16 62 BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange2>::type
Chris@16 63 out = boost::begin(to);
Chris@16 64
Chris@16 65 #ifndef NDEBUG
Chris@16 66 BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange2>::type
Chris@16 67 last_out = boost::end(to);
Chris@16 68 #endif
Chris@16 69
Chris@16 70 for( ; i != e; ++out, ++i )
Chris@16 71 {
Chris@16 72 #ifndef NDEBUG
Chris@16 73 BOOST_ASSERT( out != last_out
Chris@16 74 && "out of bounds in boost::overwrite()" );
Chris@16 75 #endif
Chris@16 76 *out = *i;
Chris@16 77 }
Chris@16 78 }
Chris@16 79
Chris@16 80 } // namespace range
Chris@16 81 using range::overwrite;
Chris@16 82 } // namespace boost
Chris@16 83
Chris@16 84 #endif // include guard