diff --git a/include/boost/range/adaptor/adjacent_filtered.hpp b/include/boost/range/adaptor/adjacent_filtered.hpp index 5f66711..c01f1c1 100644 --- a/include/boost/range/adaptor/adjacent_filtered.hpp +++ b/include/boost/range/adaptor/adjacent_filtered.hpp @@ -28,11 +28,11 @@ namespace boost { - namespace range_detail - { - template< class Iter, class Pred, bool default_pass > - class skip_iterator - : public boost::iterator_adaptor< + namespace range_detail + { + template< class Iter, class Pred, bool default_pass > + class skip_iterator + : public boost::iterator_adaptor< skip_iterator, Iter, BOOST_DEDUCED_TYPENAME std::iterator_traits::value_type, @@ -40,10 +40,10 @@ namespace boost BOOST_DEDUCED_TYPENAME std::iterator_traits::reference, BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type > - , private Pred - { - private: - typedef boost::iterator_adaptor< + , private Pred + { + private: + typedef boost::iterator_adaptor< skip_iterator, Iter, BOOST_DEDUCED_TYPENAME std::iterator_traits::value_type, @@ -52,9 +52,9 @@ namespace boost BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type > base_t; - public: + public: typedef Pred pred_t; - typedef Iter iter_t; + typedef Iter iter_t; skip_iterator() : m_last() {} @@ -66,169 +66,169 @@ namespace boost move_to_next_valid(); } - template - skip_iterator( const skip_iterator& other ) - : base_t(other.base()) - , pred_t(other) - , m_last(other.m_last) {} + template + skip_iterator( const skip_iterator& other ) + : base_t(other.base()) + , pred_t(other) + , m_last(other.m_last) {} void move_to_next_valid() - { - iter_t& it = this->base_reference(); - pred_t& bi_pred = *this; - if (it != m_last) - { - if (default_pass) - { - iter_t nxt = ::boost::next(it); - while (nxt != m_last && !bi_pred(*it, *nxt)) - { - ++it; - ++nxt; - } - } - else - { - iter_t nxt = ::boost::next(it); - for(; nxt != m_last; ++it, ++nxt) - { - if (bi_pred(*it, *nxt)) - { - break; - } - } - if (nxt == m_last) - { - it = m_last; - } - } - } - } + { + iter_t& it = this->base_reference(); + pred_t& bi_pred = *this; + if (it != m_last) + { + if (default_pass) + { + iter_t nxt = ::boost::next(it); + while (nxt != m_last && !bi_pred(*it, *nxt)) + { + ++it; + ++nxt; + } + } + else + { + iter_t nxt = ::boost::next(it); + for(; nxt != m_last; ++it, ++nxt) + { + if (bi_pred(*it, *nxt)) + { + break; + } + } + if (nxt == m_last) + { + it = m_last; + } + } + } + } - void increment() - { - iter_t& it = this->base_reference(); - BOOST_ASSERT( it != m_last ); - ++it; - move_to_next_valid(); - } + void increment() + { + iter_t& it = this->base_reference(); + BOOST_ASSERT( it != m_last ); + ++it; + move_to_next_valid(); + } iter_t m_last; - }; + }; - template< class P, class R, bool default_pass > - struct adjacent_filter_range - : iterator_range< skip_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - P, - default_pass + template< class P, class R, bool default_pass > + struct adjacent_filter_range + : iterator_range< skip_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + P, + default_pass > > - { - private: - typedef skip_iterator< + { + private: + typedef skip_iterator< BOOST_DEDUCED_TYPENAME range_iterator::type, P, default_pass > - skip_iter; + skip_iter; - typedef iterator_range - base_range; + typedef iterator_range + base_range; - typedef BOOST_DEDUCED_TYPENAME range_iterator::type raw_iterator; + typedef BOOST_DEDUCED_TYPENAME range_iterator::type raw_iterator; - public: - adjacent_filter_range( const P& p, R& r ) - : base_range( skip_iter( boost::begin(r), boost::end(r), p), - skip_iter( boost::end(r), boost::end(r), p) ) - { - } - }; + public: + adjacent_filter_range( const P& p, R& r ) + : base_range( skip_iter( boost::begin(r), boost::end(r), p), + skip_iter( boost::end(r), boost::end(r), p) ) + { + } + }; - template< class T > - struct adjacent_holder : holder - { - adjacent_holder( T r ) : holder(r) - { } - }; + template< class T > + struct adjacent_holder : holder + { + adjacent_holder( T r ) : holder(r) + { } + }; - template< class T > - struct adjacent_excl_holder : holder - { - adjacent_excl_holder( T r ) : holder(r) - { } - }; + template< class T > + struct adjacent_excl_holder : holder + { + adjacent_excl_holder( T r ) : holder(r) + { } + }; - template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range - operator|( ForwardRng& r, - const adjacent_holder& f ) - { - return adjacent_filter_range( f.val, r ); - } + template< class ForwardRng, class BinPredicate > + inline adjacent_filter_range + operator|( ForwardRng& r, + const adjacent_holder& f ) + { + return adjacent_filter_range( f.val, r ); + } - template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range - operator|( const ForwardRng& r, - const adjacent_holder& f ) - { - return adjacent_filter_range( f.val, r ); - } + template< class ForwardRng, class BinPredicate > + inline adjacent_filter_range + operator|( const ForwardRng& r, + const adjacent_holder& f ) + { + return adjacent_filter_range( f.val, r ); + } - template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range - operator|( ForwardRng& r, - const adjacent_excl_holder& f ) - { - return adjacent_filter_range( f.val, r ); - } + template< class ForwardRng, class BinPredicate > + inline adjacent_filter_range + operator|( ForwardRng& r, + const adjacent_excl_holder& f ) + { + return adjacent_filter_range( f.val, r ); + } - template< class ForwardRng, class BinPredicate > - inline adjacent_filter_range - operator|( const ForwardRng& r, - const adjacent_excl_holder& f ) - { - return adjacent_filter_range( f.val, r ); - } + template< class ForwardRng, class BinPredicate > + inline adjacent_filter_range + operator|( const ForwardRng& r, + const adjacent_excl_holder& f ) + { + return adjacent_filter_range( f.val, r ); + } - } // 'range_detail' + } // 'range_detail' - // Bring adjacent_filter_range into the boost namespace so that users of - // this library may specify the return type of the '|' operator and - // adjacent_filter() - using range_detail::adjacent_filter_range; + // Bring adjacent_filter_range into the boost namespace so that users of + // this library may specify the return type of the '|' operator and + // adjacent_filter() + using range_detail::adjacent_filter_range; - namespace adaptors - { - namespace - { - const range_detail::forwarder + namespace adaptors + { + namespace + { + const range_detail::forwarder adjacent_filtered = range_detail::forwarder(); - const range_detail::forwarder - adjacent_filtered_excl = - range_detail::forwarder(); - } + const range_detail::forwarder + adjacent_filtered_excl = + range_detail::forwarder(); + } - template - inline adjacent_filter_range - adjacent_filter(ForwardRng& rng, BinPredicate filter_pred) - { - return adjacent_filter_range(filter_pred, rng); - } + template + inline adjacent_filter_range + adjacent_filter(ForwardRng& rng, BinPredicate filter_pred) + { + return adjacent_filter_range(filter_pred, rng); + } - template - inline adjacent_filter_range - adjacent_filter(const ForwardRng& rng, BinPredicate filter_pred) - { - return adjacent_filter_range(filter_pred, rng); - } + template + inline adjacent_filter_range + adjacent_filter(const ForwardRng& rng, BinPredicate filter_pred) + { + return adjacent_filter_range(filter_pred, rng); + } - } // 'adaptors' + } // 'adaptors' } diff --git a/include/boost/range/adaptor/argument_fwd.hpp b/include/boost/range/adaptor/argument_fwd.hpp index 357056b..fbfd40c 100755 --- a/include/boost/range/adaptor/argument_fwd.hpp +++ b/include/boost/range/adaptor/argument_fwd.hpp @@ -20,57 +20,57 @@ namespace boost { - namespace range_detail - { - template< class T > - struct holder - { - T val; - holder( T t ) : val(t) - { } - }; + namespace range_detail + { + template< class T > + struct holder + { + T val; + holder( T t ) : val(t) + { } + }; - template< class T > - struct holder2 - { - T val1, val2; - holder2( T t, T u ) : val1(t), val2(u) - { } - }; - - template< template class Holder > - struct forwarder - { - template< class T > - Holder operator()( T t ) const - { - return Holder(t); - } - }; + template< class T > + struct holder2 + { + T val1, val2; + holder2( T t, T u ) : val1(t), val2(u) + { } + }; + + template< template class Holder > + struct forwarder + { + template< class T > + Holder operator()( T t ) const + { + return Holder(t); + } + }; - template< template class Holder > - struct forwarder2 - { - template< class T > - Holder operator()( T t, T u ) const - { - return Holder(t,u); - } - }; + template< template class Holder > + struct forwarder2 + { + template< class T > + Holder operator()( T t, T u ) const + { + return Holder(t,u); + } + }; - template< template class Holder > - struct forwarder2TU - { - template< class T, class U > - Holder operator()( T t, U u ) const - { - return Holder(t, u); - } - }; + template< template class Holder > + struct forwarder2TU + { + template< class T, class U > + Holder operator()( T t, U u ) const + { + return Holder(t, u); + } + }; - } - + } + } #ifdef BOOST_MSVC diff --git a/include/boost/range/adaptor/copied.hpp b/include/boost/range/adaptor/copied.hpp index 1862b5f..f4cf2d1 100755 --- a/include/boost/range/adaptor/copied.hpp +++ b/include/boost/range/adaptor/copied.hpp @@ -18,40 +18,40 @@ namespace boost { - namespace adaptors - { - struct copied - { - copied(std::size_t t_, std::size_t u_) + namespace adaptors + { + struct copied + { + copied(std::size_t t_, std::size_t u_) : t(t_), u(u_) {} std::size_t t; std::size_t u; - }; + }; - template< class CopyableRandomAccessRng > - inline CopyableRandomAccessRng - operator|( const CopyableRandomAccessRng& r, const copied& f ) - { - iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type > - temp( adaptors::slice( r, f.t, f.u ) ); - return CopyableRandomAccessRng( temp.begin(), temp.end() ); - } + template< class CopyableRandomAccessRng > + inline CopyableRandomAccessRng + operator|( const CopyableRandomAccessRng& r, const copied& f ) + { + iterator_range< + BOOST_DEDUCED_TYPENAME range_iterator::type > + temp( adaptors::slice( r, f.t, f.u ) ); + return CopyableRandomAccessRng( temp.begin(), temp.end() ); + } - template - inline CopyableRandomAccessRange - copy(const CopyableRandomAccessRange& rng, std::size_t t, std::size_t u) - { - iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type> temp( - adaptors::slice(rng, t, u)); + template + inline CopyableRandomAccessRange + copy(const CopyableRandomAccessRange& rng, std::size_t t, std::size_t u) + { + iterator_range< + BOOST_DEDUCED_TYPENAME range_iterator::type> temp( + adaptors::slice(rng, t, u)); return CopyableRandomAccessRange( temp.begin(), temp.end() ); - } - } // 'adaptors' + } + } // 'adaptors' } diff --git a/include/boost/range/adaptor/filtered.hpp b/include/boost/range/adaptor/filtered.hpp index 1bc4799..62888e7 100755 --- a/include/boost/range/adaptor/filtered.hpp +++ b/include/boost/range/adaptor/filtered.hpp @@ -17,84 +17,84 @@ namespace boost { - namespace range_detail - { - template< class P, class R > - struct filter_range : + namespace range_detail + { + template< class P, class R > + struct filter_range : boost::iterator_range< boost::filter_iterator< P, - BOOST_DEDUCED_TYPENAME range_iterator::type + BOOST_DEDUCED_TYPENAME range_iterator::type > > - { - private: - typedef boost::iterator_range< + { + private: + typedef boost::iterator_range< boost::filter_iterator< P, BOOST_DEDUCED_TYPENAME range_iterator::type > > base; - public: - filter_range( P p, R& r ) - : base( make_filter_iterator( p, boost::begin(r), boost::end(r) ), - make_filter_iterator( p, boost::end(r), boost::end(r) ) ) - { } - }; + public: + filter_range( P p, R& r ) + : base( make_filter_iterator( p, boost::begin(r), boost::end(r) ), + make_filter_iterator( p, boost::end(r), boost::end(r) ) ) + { } + }; - template< class T > - struct filter_holder : holder - { - filter_holder( T r ) : holder(r) - { } - }; + template< class T > + struct filter_holder : holder + { + filter_holder( T r ) : holder(r) + { } + }; - template< class InputRng, class Predicate > - inline filter_range - operator|( InputRng& r, - const filter_holder& f ) - { - return filter_range( f.val, r ); - } - - template< class InputRng, class Predicate > - inline filter_range - operator|( const InputRng& r, - const filter_holder& f ) - { - return filter_range( f.val, r ); - } - - } // 'range_detail' - - // Unusual use of 'using' is intended to bring filter_range into the boost namespace - // while leaving the mechanics of the '|' operator in range_detail and maintain - // argument dependent lookup. - // filter_range logically needs to be in the boost namespace to allow user of - // the library to define the return type for filter() - using range_detail::filter_range; - - namespace adaptors - { - namespace - { - const range_detail::forwarder - filtered = - range_detail::forwarder(); - } - - template - inline filter_range - filter(InputRange& rng, Predicate filter_pred) - { - return range_detail::filter_range( filter_pred, rng ); - } - - template - inline filter_range - filter(const InputRange& rng, Predicate filter_pred) - { - return range_detail::filter_range( filter_pred, rng ); + template< class InputRng, class Predicate > + inline filter_range + operator|( InputRng& r, + const filter_holder& f ) + { + return filter_range( f.val, r ); } - } // 'adaptors' + + template< class InputRng, class Predicate > + inline filter_range + operator|( const InputRng& r, + const filter_holder& f ) + { + return filter_range( f.val, r ); + } + + } // 'range_detail' + + // Unusual use of 'using' is intended to bring filter_range into the boost namespace + // while leaving the mechanics of the '|' operator in range_detail and maintain + // argument dependent lookup. + // filter_range logically needs to be in the boost namespace to allow user of + // the library to define the return type for filter() + using range_detail::filter_range; + + namespace adaptors + { + namespace + { + const range_detail::forwarder + filtered = + range_detail::forwarder(); + } + + template + inline filter_range + filter(InputRange& rng, Predicate filter_pred) + { + return range_detail::filter_range( filter_pred, rng ); + } + + template + inline filter_range + filter(const InputRange& rng, Predicate filter_pred) + { + return range_detail::filter_range( filter_pred, rng ); + } + } // 'adaptors' } diff --git a/include/boost/range/adaptor/indexed.hpp b/include/boost/range/adaptor/indexed.hpp index 7050185..5a523ce 100755 --- a/include/boost/range/adaptor/indexed.hpp +++ b/include/boost/range/adaptor/indexed.hpp @@ -40,56 +40,56 @@ namespace boost }; } - namespace range_detail - { - template< class Iter > - class indexed_iterator - : public boost::iterator_adaptor< indexed_iterator, Iter > - { - private: - typedef boost::iterator_adaptor< indexed_iterator, Iter > - base; + namespace range_detail + { + template< class Iter > + class indexed_iterator + : public boost::iterator_adaptor< indexed_iterator, Iter > + { + private: + typedef boost::iterator_adaptor< indexed_iterator, Iter > + base; - typedef BOOST_DEDUCED_TYPENAME base::difference_type index_type; + typedef BOOST_DEDUCED_TYPENAME base::difference_type index_type; - index_type m_index; + index_type m_index; - public: - explicit indexed_iterator( Iter i, index_type index ) - : base(i), m_index(index) - { - BOOST_ASSERT( m_index >= 0 && "Indexed Iterator out of bounds" ); - } + public: + explicit indexed_iterator( Iter i, index_type index ) + : base(i), m_index(index) + { + BOOST_ASSERT( m_index >= 0 && "Indexed Iterator out of bounds" ); + } - index_type index() const - { - return m_index; - } + index_type index() const + { + return m_index; + } - private: - friend class boost::iterator_core_access; + private: + friend class boost::iterator_core_access; - void increment() - { + void increment() + { ++m_index; ++(this->base_reference()); - } + } - void decrement() + void decrement() { BOOST_ASSERT( m_index > 0 && "Indexed Iterator out of bounds" ); --m_index; --(this->base_reference()); } - void advance( index_type n ) + void advance( index_type n ) { m_index += n; BOOST_ASSERT( m_index >= 0 && "Indexed Iterator out of bounds" ); this->base_reference() += n; } - }; + }; template< class Rng > struct indexed_range : @@ -107,45 +107,45 @@ namespace boost { } }; - } // 'range_detail' + } // 'range_detail' - // Make this available to users of this library. It will sometimes be - // required since it is the return type of operator '|' and - // index(). - using range_detail::indexed_range; + // Make this available to users of this library. It will sometimes be + // required since it is the return type of operator '|' and + // index(). + using range_detail::indexed_range; - namespace adaptors - { + namespace adaptors + { template< class SinglePassRange > - inline indexed_range - operator|( SinglePassRange& r, - const indexed& f ) - { - return indexed_range( f.val, r ); - } - - template< class SinglePassRange > - inline indexed_range - operator|( const SinglePassRange& r, - const indexed& f ) - { - return indexed_range( f.val, r ); - } - - template - inline indexed_range - index(SinglePassRange& rng, Index index_value) - { - return indexed_range(index_value, rng); - } - - template - inline indexed_range - index(const SinglePassRange& rng, Index index_value) - { - return indexed_range(index_value, rng); + inline indexed_range + operator|( SinglePassRange& r, + const indexed& f ) + { + return indexed_range( f.val, r ); } - } // 'adaptors' + + template< class SinglePassRange > + inline indexed_range + operator|( const SinglePassRange& r, + const indexed& f ) + { + return indexed_range( f.val, r ); + } + + template + inline indexed_range + index(SinglePassRange& rng, Index index_value) + { + return indexed_range(index_value, rng); + } + + template + inline indexed_range + index(const SinglePassRange& rng, Index index_value) + { + return indexed_range(index_value, rng); + } + } // 'adaptors' } diff --git a/include/boost/range/adaptor/indirected.hpp b/include/boost/range/adaptor/indirected.hpp index 5b13cfb..4abb3ec 100644 --- a/include/boost/range/adaptor/indirected.hpp +++ b/include/boost/range/adaptor/indirected.hpp @@ -16,72 +16,72 @@ namespace boost { - namespace range_detail - { - template< class R > - struct indirect_range : - public boost::iterator_range< + namespace range_detail + { + template< class R > + struct indirect_range : + public boost::iterator_range< boost::indirect_iterator< BOOST_DEDUCED_TYPENAME range_iterator::type > > - { - private: - typedef boost::iterator_range< + { + private: + typedef boost::iterator_range< boost::indirect_iterator< BOOST_DEDUCED_TYPENAME range_iterator::type > > - base; + base; - public: - explicit indirect_range( R& r ) + public: + explicit indirect_range( R& r ) : base( r ) - { } - }; + { } + }; - struct indirect_forwarder {}; + struct indirect_forwarder {}; - template< class InputRng > - inline indirect_range - operator|( InputRng& r, indirect_forwarder ) - { - return indirect_range( r ); - } + template< class InputRng > + inline indirect_range + operator|( InputRng& r, indirect_forwarder ) + { + return indirect_range( r ); + } - template< class InputRng > - inline indirect_range - operator|( const InputRng& r, indirect_forwarder ) - { - return indirect_range( r ); - } + template< class InputRng > + inline indirect_range + operator|( const InputRng& r, indirect_forwarder ) + { + return indirect_range( r ); + } - } // 'range_detail' + } // 'range_detail' - using range_detail::indirect_range; + using range_detail::indirect_range; - namespace adaptors - { - namespace - { - const range_detail::indirect_forwarder indirected = - range_detail::indirect_forwarder(); - } + namespace adaptors + { + namespace + { + const range_detail::indirect_forwarder indirected = + range_detail::indirect_forwarder(); + } - template - inline indirect_range - indirect(InputRange& rng) - { - return indirect_range(rng); - } + template + inline indirect_range + indirect(InputRange& rng) + { + return indirect_range(rng); + } - template - inline indirect_range - indirect(const InputRange& rng) - { - return indirect_range(rng); - } - } // 'adaptors' + template + inline indirect_range + indirect(const InputRange& rng) + { + return indirect_range(rng); + } + } // 'adaptors' } diff --git a/include/boost/range/adaptor/map.hpp b/include/boost/range/adaptor/map.hpp index f790e1a..a8a2c20 100755 --- a/include/boost/range/adaptor/map.hpp +++ b/include/boost/range/adaptor/map.hpp @@ -17,161 +17,161 @@ namespace boost { - namespace range_detail - { - struct map_keys_forwarder {}; - struct map_values_forwarder {}; + namespace range_detail + { + struct map_keys_forwarder {}; + struct map_values_forwarder {}; - template< class Map > - struct select_first - { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type& - result_type; + template< class Map > + struct select_first + { + typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; + typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type& + result_type; - result_type operator()( const pair_t& r ) const - { - return r.first; - } - }; + result_type operator()( const pair_t& r ) const + { + return r.first; + } + }; - template< class Map > - struct select_second_mutable - { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type; + template< class Map > + struct select_second_mutable + { + typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; + typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type; - result_type operator()( pair_t& r ) const - { - return r.second; - } - }; + result_type operator()( pair_t& r ) const + { + return r.second; + } + }; - template< class Map > - struct select_second_const - { - typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; - typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type& - result_type; - - result_type operator()( const pair_t& r ) const - { - return r.second; - } - }; - - template - class select_first_range - : public transform_range< - select_first, - const StdPairRng> - { - typedef transform_range, const StdPairRng> base; - public: - typedef select_first transform_fn_type; - typedef const StdPairRng source_range_type; + template< class Map > + struct select_second_const + { + typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t; + typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type& + result_type; + + result_type operator()( const pair_t& r ) const + { + return r.second; + } + }; + + template + class select_first_range + : public transform_range< + select_first, + const StdPairRng> + { + typedef transform_range, const StdPairRng> base; + public: + typedef select_first transform_fn_type; + typedef const StdPairRng source_range_type; - select_first_range(transform_fn_type fn, source_range_type& rng) - : base(fn, rng) - { - } + select_first_range(transform_fn_type fn, source_range_type& rng) + : base(fn, rng) + { + } - select_first_range(const base& other) : base(other) {} - }; - - template - class select_second_mutable_range - : public transform_range< - select_second_mutable, - StdPairRng> - { - typedef transform_range, StdPairRng> base; - public: - typedef select_second_mutable transform_fn_type; - typedef StdPairRng source_range_type; + select_first_range(const base& other) : base(other) {} + }; + + template + class select_second_mutable_range + : public transform_range< + select_second_mutable, + StdPairRng> + { + typedef transform_range, StdPairRng> base; + public: + typedef select_second_mutable transform_fn_type; + typedef StdPairRng source_range_type; - select_second_mutable_range(transform_fn_type fn, source_range_type& rng) - : base(fn, rng) - { - } + select_second_mutable_range(transform_fn_type fn, source_range_type& rng) + : base(fn, rng) + { + } - select_second_mutable_range(const base& other) : base(other) {} - }; - - template - class select_second_const_range - : public transform_range< - select_second_const, - const StdPairRng> - { - typedef transform_range, const StdPairRng> base; - public: - typedef select_second_const transform_fn_type; - typedef const StdPairRng source_range_type; + select_second_mutable_range(const base& other) : base(other) {} + }; + + template + class select_second_const_range + : public transform_range< + select_second_const, + const StdPairRng> + { + typedef transform_range, const StdPairRng> base; + public: + typedef select_second_const transform_fn_type; + typedef const StdPairRng source_range_type; - select_second_const_range(transform_fn_type fn, source_range_type& rng) - : base(fn, rng) - { - } + select_second_const_range(transform_fn_type fn, source_range_type& rng) + : base(fn, rng) + { + } - select_second_const_range(const base& other) : base(other) {} - }; - - template< class StdPairRng > - inline select_first_range - operator|( const StdPairRng& r, map_keys_forwarder ) - { - return operator|( r, - boost::adaptors::transformed( select_first() ) ); - } + select_second_const_range(const base& other) : base(other) {} + }; + + template< class StdPairRng > + inline select_first_range + operator|( const StdPairRng& r, map_keys_forwarder ) + { + return operator|( r, + boost::adaptors::transformed( select_first() ) ); + } - template< class StdPairRng > - inline select_second_mutable_range - operator|( StdPairRng& r, map_values_forwarder ) - { - return operator|( r, - boost::adaptors::transformed( select_second_mutable() ) ); - } + template< class StdPairRng > + inline select_second_mutable_range + operator|( StdPairRng& r, map_values_forwarder ) + { + return operator|( r, + boost::adaptors::transformed( select_second_mutable() ) ); + } - template< class StdPairRng > - inline select_second_const_range - operator|( const StdPairRng& r, map_values_forwarder ) - { - return operator|( r, - boost::adaptors::transformed( select_second_const() ) ); - } - - } // 'range_detail' - - using range_detail::select_first_range; - using range_detail::select_second_mutable_range; - using range_detail::select_second_const_range; + template< class StdPairRng > + inline select_second_const_range + operator|( const StdPairRng& r, map_values_forwarder ) + { + return operator|( r, + boost::adaptors::transformed( select_second_const() ) ); + } + + } // 'range_detail' + + using range_detail::select_first_range; + using range_detail::select_second_mutable_range; + using range_detail::select_second_const_range; - namespace adaptors - { - namespace - { - const range_detail::map_keys_forwarder map_keys = - range_detail::map_keys_forwarder(); + namespace adaptors + { + namespace + { + const range_detail::map_keys_forwarder map_keys = + range_detail::map_keys_forwarder(); - const range_detail::map_values_forwarder map_values = - range_detail::map_values_forwarder(); - } - - template - inline select_first_range - keys(const StdPairRange& rng) - { - return select_first_range( - range_detail::select_first(), rng ); - } - - template - inline select_second_const_range - values(const StdPairRange& rng) - { - return select_second_const_range( - range_detail::select_second_const(), rng ); + const range_detail::map_values_forwarder map_values = + range_detail::map_values_forwarder(); + } + + template + inline select_first_range + keys(const StdPairRange& rng) + { + return select_first_range( + range_detail::select_first(), rng ); + } + + template + inline select_second_const_range + values(const StdPairRange& rng) + { + return select_second_const_range( + range_detail::select_second_const(), rng ); } template @@ -181,8 +181,8 @@ namespace boost return select_second_mutable_range( range_detail::select_second_mutable(), rng ); } - } // 'adaptors' - + } // 'adaptors' + } #endif diff --git a/include/boost/range/adaptor/replaced.hpp b/include/boost/range/adaptor/replaced.hpp index bdc0a2d..3c40918 100644 --- a/include/boost/range/adaptor/replaced.hpp +++ b/include/boost/range/adaptor/replaced.hpp @@ -22,99 +22,99 @@ namespace boost { - namespace range_detail - { - template< class Value > - class replace_value - { - public: - typedef const Value& result_type; - typedef const Value& first_argument_type; + namespace range_detail + { + template< class Value > + class replace_value + { + public: + typedef const Value& result_type; + typedef const Value& first_argument_type; - replace_value(const Value& from, const Value& to) - : m_from(from), m_to(to) - { - } + replace_value(const Value& from, const Value& to) + : m_from(from), m_to(to) + { + } - const Value& operator()(const Value& x) const - { - return (x == m_from) ? m_to : x; - } + const Value& operator()(const Value& x) const + { + return (x == m_from) ? m_to : x; + } - private: - Value m_from; - Value m_to; - }; + private: + Value m_from; + Value m_to; + }; - template< class R > - class replace_range : - public boost::iterator_range< - boost::transform_iterator< - replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, - BOOST_DEDUCED_TYPENAME range_iterator::type > > - { - private: - typedef replace_value< BOOST_DEDUCED_TYPENAME range_value::type > Fn; + template< class R > + class replace_range : + public boost::iterator_range< + boost::transform_iterator< + replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, + BOOST_DEDUCED_TYPENAME range_iterator::type > > + { + private: + typedef replace_value< BOOST_DEDUCED_TYPENAME range_value::type > Fn; - typedef boost::iterator_range< - boost::transform_iterator< - replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, - BOOST_DEDUCED_TYPENAME range_iterator::type > > base_t; + typedef boost::iterator_range< + boost::transform_iterator< + replace_value< BOOST_DEDUCED_TYPENAME range_value::type >, + BOOST_DEDUCED_TYPENAME range_iterator::type > > base_t; - public: - typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; - replace_range( R& r, value_type from, value_type to ) - : base_t( make_transform_iterator( boost::begin(r), Fn(from, to) ), - make_transform_iterator( boost::end(r), Fn(from, to) ) ) - { } - }; + replace_range( R& r, value_type from, value_type to ) + : base_t( make_transform_iterator( boost::begin(r), Fn(from, to) ), + make_transform_iterator( boost::end(r), Fn(from, to) ) ) + { } + }; - template< class T > - class replace_holder : public holder2 - { - public: - replace_holder( const T& from, const T& to ) - : holder2(from, to) - { } - private: - // not assignable - void operator=(const replace_holder&); - }; + template< class T > + class replace_holder : public holder2 + { + public: + replace_holder( const T& from, const T& to ) + : holder2(from, to) + { } + private: + // not assignable + void operator=(const replace_holder&); + }; - template< class InputRng > - inline replace_range - operator|( InputRng& r, - const replace_holder::type>& f ) - { - return replace_range(r, f.val1, f.val2); - } + template< class InputRng > + inline replace_range + operator|( InputRng& r, + const replace_holder::type>& f ) + { + return replace_range(r, f.val1, f.val2); + } - template< class InputRng > - inline replace_range - operator|( const InputRng& r, - const replace_holder::type>& f ) - { - return replace_range(r, f.val1, f.val2); - } - } // 'range_detail' + template< class InputRng > + inline replace_range + operator|( const InputRng& r, + const replace_holder::type>& f ) + { + return replace_range(r, f.val1, f.val2); + } + } // 'range_detail' using range_detail::replace_range; - namespace adaptors - { - namespace - { - const range_detail::forwarder2 - replaced = - range_detail::forwarder2(); - } + namespace adaptors + { + namespace + { + const range_detail::forwarder2 + replaced = + range_detail::forwarder2(); + } - template - inline replace_range - replace(InputRange& rng, - BOOST_DEDUCED_TYPENAME range_value::type from, - BOOST_DEDUCED_TYPENAME range_value::type to) + template + inline replace_range + replace(InputRange& rng, + BOOST_DEDUCED_TYPENAME range_value::type from, + BOOST_DEDUCED_TYPENAME range_value::type to) { return replace_range(rng, from, to); } @@ -128,7 +128,7 @@ namespace boost return replace_range(rng, from ,to); } - } // 'adaptors' + } // 'adaptors' } // 'boost' #endif // include guard diff --git a/include/boost/range/adaptor/replaced_if.hpp b/include/boost/range/adaptor/replaced_if.hpp index 22264a2..9353abd 100644 --- a/include/boost/range/adaptor/replaced_if.hpp +++ b/include/boost/range/adaptor/replaced_if.hpp @@ -22,115 +22,115 @@ namespace boost { - namespace range_detail - { - template< class Pred, class Value > - class replace_value_if - { - public: - typedef const Value& result_type; - typedef const Value& first_argument_type; + namespace range_detail + { + template< class Pred, class Value > + class replace_value_if + { + public: + typedef const Value& result_type; + typedef const Value& first_argument_type; - replace_value_if(const Pred& pred, const Value& to) - : m_pred(pred), m_to(to) - { - } + replace_value_if(const Pred& pred, const Value& to) + : m_pred(pred), m_to(to) + { + } - const Value& operator()(const Value& x) const - { - return m_pred(x) ? m_to : x; - } + const Value& operator()(const Value& x) const + { + return m_pred(x) ? m_to : x; + } - private: - Pred m_pred; - Value m_to; - }; + private: + Pred m_pred; + Value m_to; + }; - template< class Pred, class R > - class replace_if_range : - public boost::iterator_range< - boost::transform_iterator< - replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type >, - BOOST_DEDUCED_TYPENAME range_iterator::type > > - { - private: - typedef replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type > Fn; + template< class Pred, class R > + class replace_if_range : + public boost::iterator_range< + boost::transform_iterator< + replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type >, + BOOST_DEDUCED_TYPENAME range_iterator::type > > + { + private: + typedef replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type > Fn; - typedef boost::iterator_range< - boost::transform_iterator< - replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type >, - BOOST_DEDUCED_TYPENAME range_iterator::type > > base_t; + typedef boost::iterator_range< + boost::transform_iterator< + replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value::type >, + BOOST_DEDUCED_TYPENAME range_iterator::type > > base_t; - public: - typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_value::type value_type; - replace_if_range( R& r, const Pred& pred, value_type to ) - : base_t( make_transform_iterator( boost::begin(r), Fn(pred, to) ), - make_transform_iterator( boost::end(r), Fn(pred, to) ) ) - { } - }; + replace_if_range( R& r, const Pred& pred, value_type to ) + : base_t( make_transform_iterator( boost::begin(r), Fn(pred, to) ), + make_transform_iterator( boost::end(r), Fn(pred, to) ) ) + { } + }; - template< class Pred, class T > - class replace_if_holder - { - public: - replace_if_holder( const Pred& pred, const T& to ) - : m_pred(pred), m_to(to) - { } + template< class Pred, class T > + class replace_if_holder + { + public: + replace_if_holder( const Pred& pred, const T& to ) + : m_pred(pred), m_to(to) + { } - const Pred& pred() const { return m_pred; } - const T& to() const { return m_to; } + const Pred& pred() const { return m_pred; } + const T& to() const { return m_to; } - private: - Pred m_pred; - T m_to; - }; + private: + Pred m_pred; + T m_to; + }; - template< class Pred, class InputRng > - inline replace_if_range - operator|( InputRng& r, - const replace_if_holder::type>& f ) - { - return replace_if_range(r, f.pred(), f.to()); - } + template< class Pred, class InputRng > + inline replace_if_range + operator|( InputRng& r, + const replace_if_holder::type>& f ) + { + return replace_if_range(r, f.pred(), f.to()); + } - template< class Pred, class InputRng > - inline replace_if_range - operator|( const InputRng& r, - const replace_if_holder::type>& f ) - { - return replace_if_range(r, f.pred(), f.to()); - } - } // 'range_detail' + template< class Pred, class InputRng > + inline replace_if_range + operator|( const InputRng& r, + const replace_if_holder::type>& f ) + { + return replace_if_range(r, f.pred(), f.to()); + } + } // 'range_detail' using range_detail::replace_if_range; - namespace adaptors - { - namespace - { - const range_detail::forwarder2TU - replaced_if = - range_detail::forwarder2TU(); - } - - template - inline replace_if_range - replace_if(InputRange& rng, Pred pred, + namespace adaptors + { + namespace + { + const range_detail::forwarder2TU + replaced_if = + range_detail::forwarder2TU(); + } + + template + inline replace_if_range + replace_if(InputRange& rng, Pred pred, BOOST_DEDUCED_TYPENAME range_value::type to) - { - return range_detail::replace_if_range(rng, pred, to); - } + { + return range_detail::replace_if_range(rng, pred, to); + } - template - inline replace_if_range - replace_if(const InputRange& rng, Pred pred, - BOOST_DEDUCED_TYPENAME range_value::type to) - { - return range_detail::replace_if_range(rng, pred, to); - } - } // 'adaptors' - + template + inline replace_if_range + replace_if(const InputRange& rng, Pred pred, + BOOST_DEDUCED_TYPENAME range_value::type to) + { + return range_detail::replace_if_range(rng, pred, to); + } + } // 'adaptors' + } // 'boost' #endif // include guard diff --git a/include/boost/range/adaptor/reversed.hpp b/include/boost/range/adaptor/reversed.hpp index afe7517..229702b 100755 --- a/include/boost/range/adaptor/reversed.hpp +++ b/include/boost/range/adaptor/reversed.hpp @@ -16,75 +16,75 @@ namespace boost { - namespace range_detail - { - template< class R > - struct reverse_range : - public boost::iterator_range< - boost::reverse_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - { - private: - typedef boost::iterator_range< - boost::reverse_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - base; - - public: - typedef boost::reverse_iterator::type> iterator; + namespace range_detail + { + template< class R > + struct reverse_range : + public boost::iterator_range< + boost::reverse_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + { + private: + typedef boost::iterator_range< + boost::reverse_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + base; + + public: + typedef boost::reverse_iterator::type> iterator; - reverse_range( R& r ) - : base( iterator(boost::end(r)), iterator(boost::begin(r)) ) - { } - }; + reverse_range( R& r ) + : base( iterator(boost::end(r)), iterator(boost::begin(r)) ) + { } + }; - struct reverse_forwarder {}; - - template< class BidirectionalRng > - inline reverse_range - operator|( BidirectionalRng& r, reverse_forwarder ) - { - return reverse_range( r ); - } - - template< class BidirectionalRng > - inline reverse_range - operator|( const BidirectionalRng& r, reverse_forwarder ) - { - return reverse_range( r ); - } - - } // 'range_detail' - - using range_detail::reverse_range; - - namespace adaptors - { - namespace - { - const range_detail::reverse_forwarder reversed = - range_detail::reverse_forwarder(); - } - - template - inline reverse_range - reverse(BidirectionalRange& rng) - { - return reverse_range(rng); - } - - template - inline reverse_range - reverse(const BidirectionalRange& rng) - { - return reverse_range(rng); + struct reverse_forwarder {}; + + template< class BidirectionalRng > + inline reverse_range + operator|( BidirectionalRng& r, reverse_forwarder ) + { + return reverse_range( r ); } - } // 'adaptors' - + + template< class BidirectionalRng > + inline reverse_range + operator|( const BidirectionalRng& r, reverse_forwarder ) + { + return reverse_range( r ); + } + + } // 'range_detail' + + using range_detail::reverse_range; + + namespace adaptors + { + namespace + { + const range_detail::reverse_forwarder reversed = + range_detail::reverse_forwarder(); + } + + template + inline reverse_range + reverse(BidirectionalRange& rng) + { + return reverse_range(rng); + } + + template + inline reverse_range + reverse(const BidirectionalRange& rng) + { + return reverse_range(rng); + } + } // 'adaptors' + } // 'boost' #endif diff --git a/include/boost/range/adaptor/sliced.hpp b/include/boost/range/adaptor/sliced.hpp index 5134a4c..e5084d6 100755 --- a/include/boost/range/adaptor/sliced.hpp +++ b/include/boost/range/adaptor/sliced.hpp @@ -27,24 +27,24 @@ namespace boost std::size_t u; }; - template< class RandomAccessRange > - inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > - slice( RandomAccessRange& rng, std::size_t t, std::size_t u ) - { - BOOST_ASSERT( t <= u && "error in slice indices" ); + template< class RandomAccessRange > + inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator::type > + slice( RandomAccessRange& rng, std::size_t t, std::size_t u ) + { + BOOST_ASSERT( t <= u && "error in slice indices" ); BOOST_ASSERT( static_cast(boost::size(rng)) >= u && - "second slice index out of bounds" ); + "second slice index out of bounds" ); - return boost::make_iterator_range( rng, t, u - boost::size(rng) ); - } + return boost::make_iterator_range( rng, t, u - boost::size(rng) ); + } - template< class RandomAccessRange > - inline iterator_range< - BOOST_DEDUCED_TYPENAME range_iterator::type > - operator|( RandomAccessRange& r, const sliced& f ) - { - return adaptors::slice( r, f.t, f.u ); - } + template< class RandomAccessRange > + inline iterator_range< + BOOST_DEDUCED_TYPENAME range_iterator::type > + operator|( RandomAccessRange& r, const sliced& f ) + { + return adaptors::slice( r, f.t, f.u ); + } } // namespace adaptors } // namespace boost diff --git a/include/boost/range/adaptor/strided.hpp b/include/boost/range/adaptor/strided.hpp index 0c394b2..5f4c4fa 100755 --- a/include/boost/range/adaptor/strided.hpp +++ b/include/boost/range/adaptor/strided.hpp @@ -18,132 +18,132 @@ namespace boost { - namespace range_detail - { + namespace range_detail + { - template - class strided_iterator - : public iterator_adaptor< - strided_iterator, - BaseIterator> - { - friend class iterator_core_access; + template + class strided_iterator + : public iterator_adaptor< + strided_iterator, + BaseIterator> + { + friend class iterator_core_access; - typedef iterator_adaptor, BaseIterator> super_t; - - public: - typedef BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type difference_type; - - strided_iterator() : m_stride() { } - - strided_iterator(const strided_iterator& other) - : super_t(other), m_stride(other.m_stride) { } - - explicit strided_iterator(BaseIterator base_it, difference_type stride) - : super_t(base_it), m_stride(stride) { } - - strided_iterator& - operator=(const strided_iterator& other) - { - super_t::operator=(other); - - // Is the interoperation of the stride safe? - m_stride = other.m_stride; - return *this; - } - - void increment() { std::advance(this->base_reference(), m_stride); } - - void decrement() { std::advance(this->base_reference(), -m_stride); } - - void advance(difference_type n) { std::advance(this->base_reference(), n * m_stride); } - - difference_type - distance_to(const strided_iterator& other) const - { - return std::distance(this->base_reference(), other.base_reference()) / m_stride; - } + typedef iterator_adaptor, BaseIterator> super_t; + + public: + typedef BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type difference_type; + + strided_iterator() : m_stride() { } + + strided_iterator(const strided_iterator& other) + : super_t(other), m_stride(other.m_stride) { } + + explicit strided_iterator(BaseIterator base_it, difference_type stride) + : super_t(base_it), m_stride(stride) { } + + strided_iterator& + operator=(const strided_iterator& other) + { + super_t::operator=(other); + + // Is the interoperation of the stride safe? + m_stride = other.m_stride; + return *this; + } + + void increment() { std::advance(this->base_reference(), m_stride); } + + void decrement() { std::advance(this->base_reference(), -m_stride); } + + void advance(difference_type n) { std::advance(this->base_reference(), n * m_stride); } + + difference_type + distance_to(const strided_iterator& other) const + { + return std::distance(this->base_reference(), other.base_reference()) / m_stride; + } - // Using the compiler generated copy constructor and - // and assignment operator - - private: - difference_type m_stride; - }; - - template inline - strided_iterator - make_strided_iterator( - const BaseIterator& first, - BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type stride) - { - return strided_iterator(first, stride); - } + // Using the compiler generated copy constructor and + // and assignment operator + + private: + difference_type m_stride; + }; + + template inline + strided_iterator + make_strided_iterator( + const BaseIterator& first, + BOOST_DEDUCED_TYPENAME std::iterator_traits::difference_type stride) + { + return strided_iterator(first, stride); + } - template< class Rng > - class strided_range - : public iterator_range::type> > - { - typedef range_detail::strided_iterator::type> iter_type; - typedef iterator_range super_t; - public: - template< typename Difference > - strided_range(Difference stride, Rng& rng) + template< class Rng > + class strided_range + : public iterator_range::type> > + { + typedef range_detail::strided_iterator::type> iter_type; + typedef iterator_range super_t; + public: + template< typename Difference > + strided_range(Difference stride, Rng& rng) : super_t(make_strided_iterator(boost::begin(rng), stride), make_strided_iterator(boost::end(rng), stride)) - { - } - }; + { + } + }; - template - class strided_holder : public holder - { - public: - strided_holder(Difference value) : holder(value) {} - }; + template + class strided_holder : public holder + { + public: + strided_holder(Difference value) : holder(value) {} + }; - template - inline strided_range - operator|(Rng& rng, const strided_holder& stride) - { - return strided_range(stride.val, rng); - } + template + inline strided_range + operator|(Rng& rng, const strided_holder& stride) + { + return strided_range(stride.val, rng); + } - template - inline strided_range - operator|(const Rng& rng, const strided_holder& stride) - { - return strided_range(stride.val, rng); - } + template + inline strided_range + operator|(const Rng& rng, const strided_holder& stride) + { + return strided_range(stride.val, rng); + } - } // namespace range_detail - - using range_detail::strided_range; + } // namespace range_detail + + using range_detail::strided_range; - namespace adaptors - { - - namespace - { - const range_detail::forwarder - strided = range_detail::forwarder(); - } - - template - inline strided_range - stride(Range& rng, Difference step) - { - return strided_range(step, rng); - } - - template - inline strided_range - stride(const Range& rng, Difference step) - { - return strided_range(step, rng); + namespace adaptors + { + + namespace + { + const range_detail::forwarder + strided = range_detail::forwarder(); } - } // namespace 'adaptors' + template + inline strided_range + stride(Range& rng, Difference step) + { + return strided_range(step, rng); + } + + template + inline strided_range + stride(const Range& rng, Difference step) + { + return strided_range(step, rng); + } + + } // namespace 'adaptors' } // namespace 'boost' #endif diff --git a/include/boost/range/adaptor/tokenized.hpp b/include/boost/range/adaptor/tokenized.hpp index c81d515..6b6a6fa 100755 --- a/include/boost/range/adaptor/tokenized.hpp +++ b/include/boost/range/adaptor/tokenized.hpp @@ -16,122 +16,122 @@ namespace boost { - namespace range_detail - { + namespace range_detail + { - template< class R > - struct token_range : - public boost::iterator_range< - boost::regex_token_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - { - private: - typedef - boost::regex_token_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type - > - regex_iter; - - typedef BOOST_DEDUCED_TYPENAME regex_iter::regex_type - regex_type; - - typedef boost::iterator_range - base; + template< class R > + struct token_range : + public boost::iterator_range< + boost::regex_token_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + { + private: + typedef + boost::regex_token_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type + > + regex_iter; + + typedef BOOST_DEDUCED_TYPENAME regex_iter::regex_type + regex_type; + + typedef boost::iterator_range + base; - public: - template< class Regex, class Submatch, class Flag > - token_range( R& r, const Regex& re, const Submatch& sub, Flag f ) - : base( regex_iter( boost::begin(r), boost::end(r), - regex_type(re), sub, f ), - regex_iter() ) - { } - }; + public: + template< class Regex, class Submatch, class Flag > + token_range( R& r, const Regex& re, const Submatch& sub, Flag f ) + : base( regex_iter( boost::begin(r), boost::end(r), + regex_type(re), sub, f ), + regex_iter() ) + { } + }; - template< class T, class U, class V > - struct regex_holder - { - const T& re; - const U& sub; - V f; + template< class T, class U, class V > + struct regex_holder + { + const T& re; + const U& sub; + V f; - regex_holder( const T& rex, const U& subm, V flag ) : - re(rex), sub(subm), f(flag) - { } - private: - // Not assignable - void operator=(const regex_holder&); - }; + regex_holder( const T& rex, const U& subm, V flag ) : + re(rex), sub(subm), f(flag) + { } + private: + // Not assignable + void operator=(const regex_holder&); + }; - struct regex_forwarder - { - template< class Regex > - regex_holder - operator()( const Regex& re, - int submatch = 0, - regex_constants::match_flag_type f = - regex_constants::match_default ) const - { - return regex_holder( re, submatch, f ); - } - - template< class Regex, class Submatch > - regex_holder - operator()( const Regex& re, - const Submatch& sub, - regex_constants::match_flag_type f = - regex_constants::match_default ) const - { - return regex_holder( re, sub, f ); - } - }; - - template< class BidirectionalRng, class R, class S, class F > - inline token_range - operator|( BidirectionalRng& r, - const regex_holder& f ) - { - return token_range( r, f.re, f.sub, f.f ); - } + struct regex_forwarder + { + template< class Regex > + regex_holder + operator()( const Regex& re, + int submatch = 0, + regex_constants::match_flag_type f = + regex_constants::match_default ) const + { + return regex_holder( re, submatch, f ); + } + + template< class Regex, class Submatch > + regex_holder + operator()( const Regex& re, + const Submatch& sub, + regex_constants::match_flag_type f = + regex_constants::match_default ) const + { + return regex_holder( re, sub, f ); + } + }; + + template< class BidirectionalRng, class R, class S, class F > + inline token_range + operator|( BidirectionalRng& r, + const regex_holder& f ) + { + return token_range( r, f.re, f.sub, f.f ); + } - template< class BidirectionalRng, class R, class S, class F > - inline token_range - operator|( const BidirectionalRng& r, - const regex_holder& f ) - { - return token_range( r, f.re, f.sub, f.f ); - } - - } // 'range_detail' + template< class BidirectionalRng, class R, class S, class F > + inline token_range + operator|( const BidirectionalRng& r, + const regex_holder& f ) + { + return token_range( r, f.re, f.sub, f.f ); + } + + } // 'range_detail' using range_detail::token_range; - namespace adaptors - { - namespace - { - const range_detail::regex_forwarder tokenized = - range_detail::regex_forwarder(); - } - - template - inline token_range - tokenize(BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f) - { - return token_range(rng, reg, sub, f); - } - - template - inline token_range - tokenize(const BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f) - { - return token_range(rng, reg, sub, f); - } - } // 'adaptors' - + namespace adaptors + { + namespace + { + const range_detail::regex_forwarder tokenized = + range_detail::regex_forwarder(); + } + + template + inline token_range + tokenize(BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f) + { + return token_range(rng, reg, sub, f); + } + + template + inline token_range + tokenize(const BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f) + { + return token_range(rng, reg, sub, f); + } + } // 'adaptors' + } #endif diff --git a/include/boost/range/adaptor/transformed.hpp b/include/boost/range/adaptor/transformed.hpp index 0eeaee7..00297ca 100755 --- a/include/boost/range/adaptor/transformed.hpp +++ b/include/boost/range/adaptor/transformed.hpp @@ -17,87 +17,87 @@ namespace boost { - namespace range_detail - { + namespace range_detail + { - template< class F, class R > - struct transform_range : - public boost::iterator_range< - boost::transform_iterator< F, - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - { - private: - typedef boost::iterator_range< - boost::transform_iterator< F, - BOOST_DEDUCED_TYPENAME range_iterator::type - > - > - base; + template< class F, class R > + struct transform_range : + public boost::iterator_range< + boost::transform_iterator< F, + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + { + private: + typedef boost::iterator_range< + boost::transform_iterator< F, + BOOST_DEDUCED_TYPENAME range_iterator::type + > + > + base; - public: - typedef F transform_fn_type; - typedef R source_range_type; - - transform_range( F f, R& r ) - : base( make_transform_iterator( boost::begin(r), f ), - make_transform_iterator( boost::end(r), f ) ) - - { } - }; + public: + typedef F transform_fn_type; + typedef R source_range_type; + + transform_range( F f, R& r ) + : base( make_transform_iterator( boost::begin(r), f ), + make_transform_iterator( boost::end(r), f ) ) + + { } + }; - template< class T > - struct transform_holder : holder - { - transform_holder( T r ) : holder(r) - { } - }; - - template< class InputRng, class UnaryFunction > - inline transform_range - operator|( InputRng& r, - const transform_holder& f ) - { - return transform_range( f.val, r ); - } - - template< class InputRng, class UnaryFunction > - inline transform_range - operator|( const InputRng& r, - const transform_holder& f ) - { - return transform_range( f.val, r ); - } - - } // 'range_detail' + template< class T > + struct transform_holder : holder + { + transform_holder( T r ) : holder(r) + { } + }; + + template< class InputRng, class UnaryFunction > + inline transform_range + operator|( InputRng& r, + const transform_holder& f ) + { + return transform_range( f.val, r ); + } + + template< class InputRng, class UnaryFunction > + inline transform_range + operator|( const InputRng& r, + const transform_holder& f ) + { + return transform_range( f.val, r ); + } + + } // 'range_detail' - using range_detail::transform_range; - - namespace adaptors - { - namespace - { - const range_detail::forwarder - transformed = + using range_detail::transform_range; + + namespace adaptors + { + namespace + { + const range_detail::forwarder + transformed = range_detail::forwarder(); - } - - template - inline transform_range - transform(InputRange& rng, UnaryFunction fn) - { - return transform_range(fn, rng); - } - - template - inline transform_range - transform(const InputRange& rng, UnaryFunction fn) - { - return transform_range(fn, rng); - } - } // 'adaptors' - + } + + template + inline transform_range + transform(InputRange& rng, UnaryFunction fn) + { + return transform_range(fn, rng); + } + + template + inline transform_range + transform(const InputRange& rng, UnaryFunction fn) + { + return transform_range(fn, rng); + } + } // 'adaptors' + } #endif diff --git a/include/boost/range/adaptor/uniqued.hpp b/include/boost/range/adaptor/uniqued.hpp index ddaf3fe..ad6f7f4 100755 --- a/include/boost/range/adaptor/uniqued.hpp +++ b/include/boost/range/adaptor/uniqued.hpp @@ -16,74 +16,74 @@ namespace boost { - namespace range_detail - { - struct unique_forwarder { }; + namespace range_detail + { + struct unique_forwarder { }; - struct unique_not_equal_to - { - typedef bool result_type; + struct unique_not_equal_to + { + typedef bool result_type; - template< class T > - bool operator()( const T& l, const T& r ) const - { - return !(l == r); - } - }; + template< class T > + bool operator()( const T& l, const T& r ) const + { + return !(l == r); + } + }; - template - class unique_range : public adjacent_filter_range - { - typedef adjacent_filter_range base; - public: - explicit unique_range(ForwardRng& rng) - : base(unique_not_equal_to(), rng) - { - } - }; + template + class unique_range : public adjacent_filter_range + { + typedef adjacent_filter_range base; + public: + explicit unique_range(ForwardRng& rng) + : base(unique_not_equal_to(), rng) + { + } + }; - template< class ForwardRng > - inline unique_range - operator|( ForwardRng& r, - unique_forwarder ) - { - return unique_range(r); - } - - template< class ForwardRng > - inline unique_range - operator|( const ForwardRng& r, - unique_forwarder ) - { - return unique_range(r); - } - - } // 'range_detail' - - using range_detail::unique_range; - - namespace adaptors - { - namespace - { - const range_detail::unique_forwarder uniqued = - range_detail::unique_forwarder(); - } - - template - inline unique_range - unique(ForwardRange& rng) - { - return unique_range(rng); - } - - template - inline unique_range - unique(const ForwardRange& rng) - { - return unique_range(rng); + template< class ForwardRng > + inline unique_range + operator|( ForwardRng& r, + unique_forwarder ) + { + return unique_range(r); } - } // 'adaptors' + + template< class ForwardRng > + inline unique_range + operator|( const ForwardRng& r, + unique_forwarder ) + { + return unique_range(r); + } + + } // 'range_detail' + + using range_detail::unique_range; + + namespace adaptors + { + namespace + { + const range_detail::unique_forwarder uniqued = + range_detail::unique_forwarder(); + } + + template + inline unique_range + unique(ForwardRange& rng) + { + return unique_range(rng); + } + + template + inline unique_range + unique(const ForwardRange& rng) + { + return unique_range(rng); + } + } // 'adaptors' } diff --git a/include/boost/range/algorithm/equal.hpp b/include/boost/range/algorithm/equal.hpp index e210ef5..7226440 100755 --- a/include/boost/range/algorithm/equal.hpp +++ b/include/boost/range/algorithm/equal.hpp @@ -20,7 +20,7 @@ namespace boost { // An implementation of equality comparison that is optimized for iterator // traversal categories less than RandomAccessTraversal. - template< class SinglePassTraversalReadableIterator1, + template< class SinglePassTraversalReadableIterator1, class SinglePassTraversalReadableIterator2, class IteratorCategoryTag1, class IteratorCategoryTag2 > diff --git a/include/boost/range/algorithm/remove_copy_if.hpp b/include/boost/range/algorithm/remove_copy_if.hpp index 665b359..791a38f 100755 --- a/include/boost/range/algorithm/remove_copy_if.hpp +++ b/include/boost/range/algorithm/remove_copy_if.hpp @@ -31,7 +31,7 @@ namespace boost remove_copy_if(SinglePassRange& rng, OutputIterator out_it, Predicate pred) { boost::function_requires< SinglePassRangeConcept >(); - return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred); + return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred); } } diff --git a/include/boost/range/algorithm_ext/for_each.hpp b/include/boost/range/algorithm_ext/for_each.hpp index 6a3b35c..a470e2b 100755 --- a/include/boost/range/algorithm_ext/for_each.hpp +++ b/include/boost/range/algorithm_ext/for_each.hpp @@ -19,55 +19,55 @@ namespace boost { - namespace range_detail - { - template - inline Fn2 for_each_impl(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - Fn2 fn) - { - for (; first1 != last1 && first2 != last2; ++first1, ++first2) - { - fn(*first1, *first2); - } - return fn; - } - } + namespace range_detail + { + template + inline Fn2 for_each_impl(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Fn2 fn) + { + for (; first1 != last1 && first2 != last2; ++first1, ++first2) + { + fn(*first1, *first2); + } + return fn; + } + } - namespace range - { - template - inline Fn2 for_each(const SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn) - { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + namespace range + { + template + inline Fn2 for_each(const SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn) + { + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - return ::boost::range_detail::for_each_impl( + return ::boost::range_detail::for_each_impl( ::boost::begin(rng1), ::boost::end(rng1), ::boost::begin(rng2), ::boost::end(rng2), fn); - } + } - template - inline Fn2 for_each(const SinglePassRange1& rng1, SinglePassRange2& rng2, Fn2 fn) - { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + template + inline Fn2 for_each(const SinglePassRange1& rng1, SinglePassRange2& rng2, Fn2 fn) + { + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - return ::boost::range_detail::for_each_impl( + return ::boost::range_detail::for_each_impl( ::boost::begin(rng1), ::boost::end(rng1), ::boost::begin(rng2), ::boost::end(rng2), fn); - } + } - template - inline Fn2 for_each(SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn) - { - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + template + inline Fn2 for_each(SinglePassRange1& rng1, const SinglePassRange2& rng2, Fn2 fn) + { + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); + BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - return ::boost::range_detail::for_each_impl( + return ::boost::range_detail::for_each_impl( ::boost::begin(rng1), ::boost::end(rng1), ::boost::begin(rng2), ::boost::end(rng2), fn); - } + } template inline Fn2 for_each(SinglePassRange1& rng1, SinglePassRange2& rng2, Fn2 fn) @@ -79,8 +79,8 @@ namespace boost ::boost::begin(rng1), ::boost::end(rng1), ::boost::begin(rng2), ::boost::end(rng2), fn); } - } // namespace range - using range::for_each; + } // namespace range + using range::for_each; } // namespace boost #endif // include guard diff --git a/include/boost/range/counting_range.hpp b/include/boost/range/counting_range.hpp index c1ca5ec..bf22f7c 100755 --- a/include/boost/range/counting_range.hpp +++ b/include/boost/range/counting_range.hpp @@ -25,41 +25,41 @@ namespace boost { - template - inline iterator_range > - counting_range(Value first, Value last) - { - typedef counting_iterator counting_iterator_t; - typedef iterator_range result_t; - return result_t(counting_iterator_t(first), - counting_iterator_t(last)); - } + template + inline iterator_range > + counting_range(Value first, Value last) + { + typedef counting_iterator counting_iterator_t; + typedef iterator_range result_t; + return result_t(counting_iterator_t(first), + counting_iterator_t(last)); + } - template - inline iterator_range::type> > - counting_range(const Range& rng) - { - typedef counting_iterator::type> counting_iterator_t; - typedef iterator_range result_t; - return boost::empty(rng) - ? result_t() - : result_t( + template + inline iterator_range::type> > + counting_range(const Range& rng) + { + typedef counting_iterator::type> counting_iterator_t; + typedef iterator_range result_t; + return boost::empty(rng) + ? result_t() + : result_t( counting_iterator_t(*boost::begin(rng)), counting_iterator_t(*boost::prior(boost::end(rng)))); - } + } - template - inline iterator_range::type> > - counting_range(Range& rng) - { - typedef counting_iterator::type> counting_iterator_t; - typedef iterator_range result_t; - return boost::empty(rng) - ? result_t() - : result_t( + template + inline iterator_range::type> > + counting_range(Range& rng) + { + typedef counting_iterator::type> counting_iterator_t; + typedef iterator_range result_t; + return boost::empty(rng) + ? result_t() + : result_t( counting_iterator_t(*boost::begin(rng)), counting_iterator_t(*boost::prior(boost::end(rng)))); - } + } } // namespace boost #if BOOST_MSVC >= 1400 diff --git a/include/boost/range/detail/demote_iterator_traversal_tag.hpp b/include/boost/range/detail/demote_iterator_traversal_tag.hpp index 4351c85..5d77678 100755 --- a/include/boost/range/detail/demote_iterator_traversal_tag.hpp +++ b/include/boost/range/detail/demote_iterator_traversal_tag.hpp @@ -15,8 +15,8 @@ namespace boost { - namespace range_detail - { + namespace range_detail + { template struct demote_iterator_traversal_tag @@ -26,7 +26,7 @@ struct demote_iterator_traversal_tag #define BOOST_DEMOTE_TRAVERSAL_TAG( Tag1, Tag2, ResultTag ) \ template<> struct demote_iterator_traversal_tag< Tag1 , Tag2 > \ { \ - typedef ResultTag type; \ + typedef ResultTag type; \ }; BOOST_DEMOTE_TRAVERSAL_TAG( no_traversal_tag, no_traversal_tag, no_traversal_tag ) @@ -73,7 +73,7 @@ BOOST_DEMOTE_TRAVERSAL_TAG( random_access_traversal_tag, random_access_traversal #undef BOOST_DEMOTE_TRAVERSAL_TAG - } // namespace range_detail + } // namespace range_detail } // namespace boost #endif // include guard diff --git a/include/boost/range/join.hpp b/include/boost/range/join.hpp index 374df86..518026c 100644 --- a/include/boost/range/join.hpp +++ b/include/boost/range/join.hpp @@ -21,46 +21,46 @@ namespace boost template iterator_range::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME add_const< - BOOST_DEDUCED_TYPENAME range_value::type>::type> + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME add_const< + BOOST_DEDUCED_TYPENAME range_value::type>::type> > join(const SinglePassRange1& r1, const SinglePassRange2& r2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - typedef range_detail::join_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME add_const< - BOOST_DEDUCED_TYPENAME range_value::type>::type> iterator_t; + typedef range_detail::join_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME add_const< + BOOST_DEDUCED_TYPENAME range_value::type>::type> iterator_t; - return iterator_range( - iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), - iterator_t(r1, r2, range_detail::join_iterator_end_tag())); + return iterator_range( + iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), + iterator_t(r1, r2, range_detail::join_iterator_end_tag())); } template iterator_range::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_value::type> + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_value::type> > join(SinglePassRange1& r1, SinglePassRange2& r2) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - typedef range_detail::join_iterator< - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_iterator::type, - BOOST_DEDUCED_TYPENAME range_value::type> iterator_t; + typedef range_detail::join_iterator< + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_iterator::type, + BOOST_DEDUCED_TYPENAME range_value::type> iterator_t; - return iterator_range( - iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), - iterator_t(r1, r2, range_detail::join_iterator_end_tag())); + return iterator_range( + iterator_t(r1, r2, range_detail::join_iterator_begin_tag()), + iterator_t(r1, r2, range_detail::join_iterator_end_tag())); } } // namespace boost diff --git a/include/boost/range/numeric.hpp b/include/boost/range/numeric.hpp index 17e2cfe..0a76151 100755 --- a/include/boost/range/numeric.hpp +++ b/include/boost/range/numeric.hpp @@ -20,7 +20,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #if defined(_MSC_VER) && _MSC_VER >= 1000 - #pragma once + #pragma once #endif #ifndef BOOST_RANGE_NUMERIC_HPP @@ -36,82 +36,82 @@ namespace boost { - template< class SinglePassRange, class Value > - inline Value accumulate( const SinglePassRange& rng, Value init ) - { + template< class SinglePassRange, class Value > + inline Value accumulate( const SinglePassRange& rng, Value init ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::accumulate( boost::begin(rng), boost::end(rng), init ); - } + return std::accumulate( boost::begin(rng), boost::end(rng), init ); + } - template< class SinglePassRange, class Value, class BinaryOperation > - inline Value accumulate( const SinglePassRange& rng, Value init, BinaryOperation op ) - { + template< class SinglePassRange, class Value, class BinaryOperation > + inline Value accumulate( const SinglePassRange& rng, Value init, BinaryOperation op ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::accumulate( boost::begin(rng), boost::end(rng), init, op ); - } + return std::accumulate( boost::begin(rng), boost::end(rng), init, op ); + } - template< class SinglePassRange1, class SinglePassRange2, class Value > - inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init ) - { + template< class SinglePassRange1, class SinglePassRange2, class Value > + inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init ) + { boost::function_requires< SinglePassRangeConcept >(); boost::function_requires< SinglePassRangeConcept >(); BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) ); - return std::inner_product( boost::begin(rng1), boost::end(rng1), + return std::inner_product( boost::begin(rng1), boost::end(rng1), boost::begin(rng2), init ); - } + } - template< class SinglePassRange1, + template< class SinglePassRange1, class SinglePassRange2, class Value, - class BinaryOperation1, class BinaryOperation2 > - inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, + class BinaryOperation1, class BinaryOperation2 > + inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init, - BinaryOperation1 op1, BinaryOperation2 op2 ) - { + BinaryOperation1 op1, BinaryOperation2 op2 ) + { boost::function_requires< SinglePassRangeConcept >(); boost::function_requires< SinglePassRangeConcept >(); BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) ); - return std::inner_product( boost::begin(rng1), boost::end(rng1), + return std::inner_product( boost::begin(rng1), boost::end(rng1), boost::begin(rng2), init, op1, op2 ); - } + } - template< class SinglePassRange, class OutputIterator > - inline OutputIterator partial_sum ( const SinglePassRange& rng, - OutputIterator result ) - { + template< class SinglePassRange, class OutputIterator > + inline OutputIterator partial_sum ( const SinglePassRange& rng, + OutputIterator result ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::partial_sum( boost::begin(rng), boost::end(rng), result ); - } + return std::partial_sum( boost::begin(rng), boost::end(rng), result ); + } - template< class SinglePassRange, class OutputIterator, class BinaryOperation > - inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result, - BinaryOperation op ) - { + template< class SinglePassRange, class OutputIterator, class BinaryOperation > + inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result, + BinaryOperation op ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::partial_sum( boost::begin(rng), boost::end(rng), result, op ); - } + return std::partial_sum( boost::begin(rng), boost::end(rng), result, op ); + } - template< class SinglePassRange, class OutputIterator > - inline OutputIterator adjacent_difference ( const SinglePassRange& rng, - OutputIterator result ) - { + template< class SinglePassRange, class OutputIterator > + inline OutputIterator adjacent_difference ( const SinglePassRange& rng, + OutputIterator result ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::adjacent_difference( boost::begin(rng), boost::end(rng), - result ); - } + return std::adjacent_difference( boost::begin(rng), boost::end(rng), + result ); + } - template< class SinglePassRange, class OutputIterator, class BinaryOperation > - inline OutputIterator adjacent_difference ( const SinglePassRange& rng, - OutputIterator result, - BinaryOperation op ) - { + template< class SinglePassRange, class OutputIterator, class BinaryOperation > + inline OutputIterator adjacent_difference ( const SinglePassRange& rng, + OutputIterator result, + BinaryOperation op ) + { boost::function_requires< SinglePassRangeConcept >(); - return std::adjacent_difference( boost::begin(rng), boost::end(rng), - result, op ); - } - + return std::adjacent_difference( boost::begin(rng), boost::end(rng), + result, op ); + } + } #endif diff --git a/include/boost/range/size_type.hpp b/include/boost/range/size_type.hpp index 9993d55..8c184f8 100644 --- a/include/boost/range/size_type.hpp +++ b/include/boost/range/size_type.hpp @@ -68,7 +68,7 @@ namespace boost template< class T > struct range_size - : detail::range_size + : detail::range_size { }; } // namespace boost diff --git a/test/adaptor_test/adjacent_filtered_example.cpp b/test/adaptor_test/adjacent_filtered_example.cpp index b3538e8..ce132d6 100644 --- a/test/adaptor_test/adjacent_filtered_example.cpp +++ b/test/adaptor_test/adjacent_filtered_example.cpp @@ -55,4 +55,4 @@ init_unit_test_suite(int argc, char* argv[]) test->add( BOOST_TEST_CASE( &adjacent_filtered_example_test ) ); return test; -} \ No newline at end of file +} diff --git a/test/adaptor_test/copied_example.cpp b/test/adaptor_test/copied_example.cpp index f662a45..154a110 100644 --- a/test/adaptor_test/copied_example.cpp +++ b/test/adaptor_test/copied_example.cpp @@ -55,4 +55,4 @@ init_unit_test_suite(int argc, char* argv[]) test->add( BOOST_TEST_CASE( &copied_example_test ) ); return test; -} \ No newline at end of file +} diff --git a/test/algorithm_test/find.cpp b/test/algorithm_test/find.cpp index 6b3d532..fd179f1 100644 --- a/test/algorithm_test/find.cpp +++ b/test/algorithm_test/find.cpp @@ -36,16 +36,16 @@ namespace boost return boost::find(cont, 3); } - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::find(cont, 3); - } - }; + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::find(cont, 3); + } + }; template BOOST_DEDUCED_TYPENAME range_iterator::type diff --git a/test/algorithm_test/find_end.cpp b/test/algorithm_test/find_end.cpp index fb44e52..a126e87 100644 --- a/test/algorithm_test/find_end.cpp +++ b/test/algorithm_test/find_end.cpp @@ -35,7 +35,7 @@ namespace boost { } - container2_t cont() { return m_cont; } + container2_t cont() { return m_cont; } template BOOST_DEDUCED_TYPENAME range_iterator::type @@ -45,14 +45,14 @@ namespace boost } template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::find_end(cont, policy.cont()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::find_end(cont, policy.cont()); + } }; template @@ -77,8 +77,8 @@ namespace boost { } - container2_t& cont() { return m_cont; } - BinaryPredicate& pred() { return m_pred; } + container2_t& cont() { return m_cont; } + BinaryPredicate& pred() { return m_pred; } template BOOST_DEDUCED_TYPENAME range_iterator::type @@ -88,14 +88,14 @@ namespace boost } template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::find_end(cont, policy.cont(), policy.pred()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::find_end(cont, policy.cont(), policy.pred()); + } }; template diff --git a/test/algorithm_test/find_first_of.cpp b/test/algorithm_test/find_first_of.cpp index b3d18e2..9ff7adb 100644 --- a/test/algorithm_test/find_first_of.cpp +++ b/test/algorithm_test/find_first_of.cpp @@ -35,7 +35,7 @@ namespace boost { } - container2_t& cont() { return m_cont; } + container2_t& cont() { return m_cont; } template BOOST_DEDUCED_TYPENAME range_iterator::type @@ -45,14 +45,14 @@ namespace boost } template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::find_first_of(cont, policy.cont()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::find_first_of(cont, policy.cont()); + } }; template @@ -77,8 +77,8 @@ namespace boost { } - container2_t& cont() { return m_cont; } - BinaryPredicate& pred() { return m_pred; } + container2_t& cont() { return m_cont; } + BinaryPredicate& pred() { return m_pred; } template BOOST_DEDUCED_TYPENAME range_iterator::type @@ -88,14 +88,14 @@ namespace boost } template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::find_first_of(cont, policy.cont(), policy.pred()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::find_first_of(cont, policy.cont(), policy.pred()); + } }; template diff --git a/test/algorithm_test/find_if.cpp b/test/algorithm_test/find_if.cpp index 4ee85a2..a5fe459 100644 --- a/test/algorithm_test/find_if.cpp +++ b/test/algorithm_test/find_if.cpp @@ -41,15 +41,15 @@ namespace boost return boost::find_if(cont, m_pred); } - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(find_if_test_policy& policy, Container& cont) - { - return boost::find_if(cont, policy.pred()); - } + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(find_if_test_policy& policy, Container& cont) + { + return boost::find_if(cont, policy.pred()); + } }; template @@ -59,7 +59,7 @@ namespace boost return std::find_if(cont.begin(), cont.end(), m_pred); } - UnaryPredicate& pred() { return m_pred; } + UnaryPredicate& pred() { return m_pred; } private: UnaryPredicate m_pred; diff --git a/test/algorithm_test/for_each.cpp b/test/algorithm_test/for_each.cpp index 56f2ef5..ac517ad 100644 --- a/test/algorithm_test/for_each.cpp +++ b/test/algorithm_test/for_each.cpp @@ -83,4 +83,4 @@ init_unit_test_suite(int argc, char* argv[]) test->add( BOOST_TEST_CASE( &boost::test_for_each ) ); return test; -} \ No newline at end of file +} diff --git a/test/algorithm_test/lower_bound.cpp b/test/algorithm_test/lower_bound.cpp index 44cc120..ca622bc 100644 --- a/test/algorithm_test/lower_bound.cpp +++ b/test/algorithm_test/lower_bound.cpp @@ -36,16 +36,16 @@ namespace boost return boost::lower_bound(cont, 5); } - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::lower_bound(cont, 5); - } - }; + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::lower_bound(cont, 5); + } + }; template< class Container > BOOST_DEDUCED_TYPENAME range_iterator::type @@ -66,15 +66,15 @@ namespace boost } template< range_return_value return_type > - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::lower_bound( - cont, 5, policy.pred()); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::lower_bound( + cont, 5, policy.pred()); + } }; template @@ -85,10 +85,10 @@ namespace boost cont.begin(), cont.end(), 5, m_pred); } - BinaryPredicate& pred() { return m_pred; } + BinaryPredicate& pred() { return m_pred; } - private: - BinaryPredicate m_pred; + private: + BinaryPredicate m_pred; }; template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::max_element(cont); - } + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::max_element(cont); + } }; template< class Container > @@ -66,17 +66,17 @@ namespace boost return boost::max_element(cont, Pred()); } - Pred pred() const { return Pred(); } + Pred pred() const { return Pred(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::max_element(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::max_element(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/min_element.cpp b/test/algorithm_test/min_element.cpp index 400372d..c68a655 100644 --- a/test/algorithm_test/min_element.cpp +++ b/test/algorithm_test/min_element.cpp @@ -37,14 +37,14 @@ namespace boost } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::min_element(cont); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::min_element(cont); + } }; template< class Container > @@ -66,17 +66,17 @@ namespace boost return boost::min_element(cont, Pred()); } - Pred pred() const { return Pred(); } + Pred pred() const { return Pred(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::min_element(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::min_element(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/partition.cpp b/test/algorithm_test/partition.cpp index e71c9a7..3f0ce61 100644 --- a/test/algorithm_test/partition.cpp +++ b/test/algorithm_test/partition.cpp @@ -44,17 +44,17 @@ namespace boost return boost::partition(cont, UnaryPredicate()); } - UnaryPredicate pred() const { return UnaryPredicate(); } + UnaryPredicate pred() const { return UnaryPredicate(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::partition(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::partition(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/stable_partition.cpp b/test/algorithm_test/stable_partition.cpp index 99db6be..fad4bef 100644 --- a/test/algorithm_test/stable_partition.cpp +++ b/test/algorithm_test/stable_partition.cpp @@ -44,17 +44,17 @@ namespace boost return boost::stable_partition(cont, UnaryPredicate()); } - UnaryPredicate pred() const { return UnaryPredicate(); } + UnaryPredicate pred() const { return UnaryPredicate(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::stable_partition(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::stable_partition(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/unique.cpp b/test/algorithm_test/unique.cpp index f5d75cf..2e2ebfa 100644 --- a/test/algorithm_test/unique.cpp +++ b/test/algorithm_test/unique.cpp @@ -41,14 +41,14 @@ namespace boost } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::unique(cont); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::unique(cont); + } }; template< class Container > @@ -73,17 +73,17 @@ namespace boost return std::unique(cont.begin(), cont.end(), Pred()); } - Pred pred() const { return Pred(); } + Pred pred() const { return Pred(); } template< range_return_value return_type > - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::unique(cont, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::unique(cont, policy.pred()); + } }; template< class Container > diff --git a/test/algorithm_test/upper_bound.cpp b/test/algorithm_test/upper_bound.cpp index 3df7164..2eb64cf 100644 --- a/test/algorithm_test/upper_bound.cpp +++ b/test/algorithm_test/upper_bound.cpp @@ -35,16 +35,16 @@ namespace boost return boost::upper_bound(cont, 5); } - template - struct test_range - { - template - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy&, Container& cont) - { - return boost::upper_bound(cont, 5); - } - }; + template + struct test_range + { + template + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy&, Container& cont) + { + return boost::upper_bound(cont, 5); + } + }; template< class Container > BOOST_DEDUCED_TYPENAME range_iterator::type @@ -65,15 +65,15 @@ namespace boost } template< range_return_value result_type> - struct test_range - { - template< class Container, class Policy > - BOOST_DEDUCED_TYPENAME range_return::type - operator()(Policy& policy, Container& cont) - { - return boost::upper_bound( - cont, 5, policy.pred()); - } + struct test_range + { + template< class Container, class Policy > + BOOST_DEDUCED_TYPENAME range_return::type + operator()(Policy& policy, Container& cont) + { + return boost::upper_bound( + cont, 5, policy.pred()); + } }; template @@ -83,11 +83,11 @@ namespace boost return std::upper_bound( cont.begin(), cont.end(), 5, BinaryPredicate()); } - - BinaryPredicate& pred() { return m_pred; } - - private: - BinaryPredicate m_pred; + + BinaryPredicate& pred() { return m_pred; } + + private: + BinaryPredicate m_pred; }; templateadd( BOOST_TEST_CASE( &boost::counting_range_test ) ); return test; -} \ No newline at end of file +} diff --git a/test/iterator_range.cpp b/test/iterator_range.cpp index cf22463..7c53a8b 100644 --- a/test/iterator_range.cpp +++ b/test/iterator_range.cpp @@ -61,7 +61,7 @@ void check_iterator_range() BOOST_CHECK_EQUAL( r2.size(), size( r2 ) ); BOOST_CHECK_EQUAL( std::distance( r.begin(), r.end() ), - std::distance( boost::begin( r2 ), boost::end( r2 ) ) ); + std::distance( boost::begin( r2 ), boost::end( r2 ) ) ); std::cout << r << r2; diff --git a/test/test_driver/range_return_test_driver.hpp b/test/test_driver/range_return_test_driver.hpp index 6f4fc3b..eb52474 100644 --- a/test/test_driver/range_return_test_driver.hpp +++ b/test/test_driver/range_return_test_driver.hpp @@ -379,25 +379,25 @@ namespace boost range_result, reference_it); } - template< range_return_value result_type, class Container, class TestPolicy > - struct test_range - { - void operator()(Container& cont, TestPolicy policy) - { - typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; - typedef BOOST_DEDUCED_TYPENAME range_return::type range_return_t; - typedef BOOST_DEDUCED_TYPENAME TestPolicy::template test_range test_range_t; + template< range_return_value result_type, class Container, class TestPolicy > + struct test_range + { + void operator()(Container& cont, TestPolicy policy) + { + typedef BOOST_DEDUCED_TYPENAME range_iterator::type iterator_t; + typedef BOOST_DEDUCED_TYPENAME range_return::type range_return_t; + typedef BOOST_DEDUCED_TYPENAME TestPolicy::template test_range test_range_t; - Container reference(cont); - Container test_cont(cont); + Container reference(cont); + Container test_cont(cont); - range_return_t range_result = test_range_t()(policy, test_cont); - iterator_t reference_it = policy.reference(reference); + range_return_t range_result = test_range_t()(policy, test_cont); + iterator_t reference_it = policy.reference(reference); - check_results::check(test_cont, reference, + check_results::check(test_cont, reference, range_result, reference_it); - } - }; + } + }; }; } }