diff --git a/include/boost/range/adaptor/adjacent_filtered.hpp b/include/boost/range/adaptor/adjacent_filtered.hpp index edc1dff..f717cb3 100644 --- a/include/boost/range/adaptor/adjacent_filtered.hpp +++ b/include/boost/range/adaptor/adjacent_filtered.hpp @@ -143,10 +143,6 @@ namespace boost skip_iter(boost::end(r), boost::end(r), p)) { } - - private: - P m_pred; - R* m_range; }; template< class T > diff --git a/include/boost/range/adaptor/argument_fwd.hpp b/include/boost/range/adaptor/argument_fwd.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/copied.hpp b/include/boost/range/adaptor/copied.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/define_adaptor.hpp b/include/boost/range/adaptor/define_adaptor.hpp index 26f4016..b228df3 100644 --- a/include/boost/range/adaptor/define_adaptor.hpp +++ b/include/boost/range/adaptor/define_adaptor.hpp @@ -44,24 +44,6 @@ return range_adaptor (rng); \ } -#define BOOST_DEFINE_RANGE_ADAPTOR_1( adaptor_name, range_adaptor, adaptor_class ) \ - template range_adaptor \ - operator|(Range& rng, const adaptor_name & args) \ - { \ - return range_adaptor (rng, args.arg1); \ - } \ - template range_adaptor \ - operator|(const Range& rng, const adaptor_name & args) \ - { \ - return range_adaptor (rng, args.arg1); \ - } \ - template \ - range_adaptor \ - make_##adaptor_name(Range& rng, Arg1 arg1) \ - { \ - return range_adaptor(rng, arg1); \ - } - #define BOOST_DEFINE_RANGE_ADAPTOR_1( adaptor_name, range_adaptor, arg1_type ) \ struct adaptor_name \ { \ diff --git a/include/boost/range/adaptor/filtered.hpp b/include/boost/range/adaptor/filtered.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/indexed.hpp b/include/boost/range/adaptor/indexed.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/map.hpp b/include/boost/range/adaptor/map.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/reversed.hpp b/include/boost/range/adaptor/reversed.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/sliced.hpp b/include/boost/range/adaptor/sliced.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/strided.hpp b/include/boost/range/adaptor/strided.hpp old mode 100755 new mode 100644 index abfad5e..e843f62 --- a/include/boost/range/adaptor/strided.hpp +++ b/include/boost/range/adaptor/strided.hpp @@ -176,6 +176,7 @@ namespace boost strided_iterator() : m_first() , m_last() + , m_index(0) , m_stride() { } @@ -184,6 +185,7 @@ namespace boost : super_t(it) , m_first(first) , m_last(last) + , m_index(stride ? (it - first) / stride : 0) , m_stride(stride) { } @@ -194,6 +196,7 @@ namespace boost : super_t(other.base()) , m_first(other.base_begin()) , m_last(other.base_end()) + , m_index(other.get_index()) , m_stride(other.get_stride()) { } @@ -201,44 +204,37 @@ namespace boost base_iterator base_begin() const { return m_first; } base_iterator base_end() const { return m_last; } difference_type get_stride() const { return m_stride; } + difference_type get_index() const { return m_index; } private: void increment() { - base_iterator& it = this->base_reference(); - if ((m_last - it) > m_stride) - it += m_stride; + m_index += m_stride; + if (m_index < (m_last - m_first)) + this->base_reference() = m_first + m_index; else - it = m_last; + this->base_reference() = m_last; } void decrement() { - base_iterator& it = this->base_reference(); - if ((it - m_first) > m_stride) - it -= m_stride; + m_index -= m_stride; + if (m_index >= 0) + this->base_reference() = m_first + m_index; else - it = m_first; + this->base_reference() = m_first; } void advance(difference_type offset) { - base_iterator& it = this->base_reference(); offset *= m_stride; - if (offset >= 0) - { - if ((m_last - it) > offset) - it += offset; - else - it = m_last; - } + m_index += offset; + if (m_index < 0) + this->base_reference() = m_first; + else if (m_index > (m_last - m_first)) + this->base_reference() = m_last; else - { - if ((m_first - it) > offset) - it += offset; - else - it = m_first; - } + this->base_reference() = m_first + m_index; } template @@ -252,12 +248,13 @@ namespace boost bool equal(const strided_iterator& other) const { - return other.base() == this->base(); + return this->base() == other.base(); } private: base_iterator m_first; base_iterator m_last; + difference_type m_index; difference_type m_stride; }; diff --git a/include/boost/range/adaptor/tokenized.hpp b/include/boost/range/adaptor/tokenized.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/transformed.hpp b/include/boost/range/adaptor/transformed.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptor/uniqued.hpp b/include/boost/range/adaptor/uniqued.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/adaptors.hpp b/include/boost/range/adaptors.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm.hpp b/include/boost/range/algorithm.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/adjacent_find.hpp b/include/boost/range/algorithm/adjacent_find.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/binary_search.hpp b/include/boost/range/algorithm/binary_search.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/copy_backward.hpp b/include/boost/range/algorithm/copy_backward.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/count.hpp b/include/boost/range/algorithm/count.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/count_if.hpp b/include/boost/range/algorithm/count_if.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/equal.hpp b/include/boost/range/algorithm/equal.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/equal_range.hpp b/include/boost/range/algorithm/equal_range.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/fill.hpp b/include/boost/range/algorithm/fill.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/fill_n.hpp b/include/boost/range/algorithm/fill_n.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/find.hpp b/include/boost/range/algorithm/find.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/find_end.hpp b/include/boost/range/algorithm/find_end.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/find_first_of.hpp b/include/boost/range/algorithm/find_first_of.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/find_if.hpp b/include/boost/range/algorithm/find_if.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/for_each.hpp b/include/boost/range/algorithm/for_each.hpp old mode 100755 new mode 100644 index 714a06f..12c9d4d --- a/include/boost/range/algorithm/for_each.hpp +++ b/include/boost/range/algorithm/for_each.hpp @@ -13,13 +13,53 @@ #include #include #include +#include +#include #include +#if BOOST_WORKAROUND(BOOST_MSVC, == 1600) +#include +#endif + namespace boost { namespace range { +#if BOOST_WORKAROUND(BOOST_MSVC, == 1600) + namespace for_each_detail + { + template + inline UnaryFunction + for_each_impl(Iterator first, Iterator last, UnaryFunction fun, + typename enable_if< + is_reference_wrapper, + void + >::type* = 0) + { + typedef typename std::_Get_unchecked_type::type + unchecked_iterator; + + unchecked_iterator unchecked_last = std::_Unchecked(last); + for (unchecked_iterator unchecked_first = std::_Unchecked(first); first != last; ++first) + fun.get()(*unchecked_first); + + return fun; + } + + template + inline UnaryFunction + for_each_impl(Iterator first, Iterator last, UnaryFunction fn, + typename disable_if< + is_reference_wrapper, + void + >::type* = 0) + { + return std::for_each(first, last, fn); + } + } +#endif + /// \brief template function for_each /// /// range-based version of the for_each std algorithm @@ -30,7 +70,18 @@ template< class SinglePassRange, class UnaryFunction > inline UnaryFunction for_each(SinglePassRange & rng, UnaryFunction fun) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - return std::for_each(boost::begin(rng),boost::end(rng),fun); + +#if BOOST_WORKAROUND(BOOST_MSVC, == 1600) + return for_each_detail::for_each_impl< + typename range_iterator::type, + UnaryFunction + >(boost::begin(rng), boost::end(rng), fun); +#else + return std::for_each< + BOOST_DEDUCED_TYPENAME range_iterator::type, + UnaryFunction + >(boost::begin(rng),boost::end(rng),fun); +#endif } /// \overload @@ -38,7 +89,18 @@ template< class SinglePassRange, class UnaryFunction > inline UnaryFunction for_each(const SinglePassRange& rng, UnaryFunction fun) { BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept )); - return std::for_each(boost::begin(rng), boost::end(rng), fun); + +#if BOOST_WORKAROUND(BOOST_MSVC, == 1600) + return for_each_detail::for_each_impl< + typename range_iterator::type, + UnaryFunction + >(boost::begin(rng), boost::end(rng), fun); +#else + return std::for_each< + BOOST_DEDUCED_TYPENAME range_iterator::type, + UnaryFunction + >(boost::begin(rng), boost::end(rng), fun); +#endif } } // namespace range diff --git a/include/boost/range/algorithm/generate.hpp b/include/boost/range/algorithm/generate.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/heap_algorithm.hpp b/include/boost/range/algorithm/heap_algorithm.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/inplace_merge.hpp b/include/boost/range/algorithm/inplace_merge.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/lexicographical_compare.hpp b/include/boost/range/algorithm/lexicographical_compare.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/lower_bound.hpp b/include/boost/range/algorithm/lower_bound.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/max_element.hpp b/include/boost/range/algorithm/max_element.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/merge.hpp b/include/boost/range/algorithm/merge.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/min_element.hpp b/include/boost/range/algorithm/min_element.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/mismatch.hpp b/include/boost/range/algorithm/mismatch.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/nth_element.hpp b/include/boost/range/algorithm/nth_element.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/partial_sort.hpp b/include/boost/range/algorithm/partial_sort.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/partial_sort_copy.hpp b/include/boost/range/algorithm/partial_sort_copy.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/partition.hpp b/include/boost/range/algorithm/partition.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/permutation.hpp b/include/boost/range/algorithm/permutation.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/random_shuffle.hpp b/include/boost/range/algorithm/random_shuffle.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/remove.hpp b/include/boost/range/algorithm/remove.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/remove_copy.hpp b/include/boost/range/algorithm/remove_copy.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/remove_copy_if.hpp b/include/boost/range/algorithm/remove_copy_if.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/remove_if.hpp b/include/boost/range/algorithm/remove_if.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/replace.hpp b/include/boost/range/algorithm/replace.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/replace_copy.hpp b/include/boost/range/algorithm/replace_copy.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/replace_copy_if.hpp b/include/boost/range/algorithm/replace_copy_if.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/replace_if.hpp b/include/boost/range/algorithm/replace_if.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/reverse.hpp b/include/boost/range/algorithm/reverse.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/reverse_copy.hpp b/include/boost/range/algorithm/reverse_copy.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/rotate.hpp b/include/boost/range/algorithm/rotate.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/rotate_copy.hpp b/include/boost/range/algorithm/rotate_copy.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/search.hpp b/include/boost/range/algorithm/search.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/search_n.hpp b/include/boost/range/algorithm/search_n.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/set_algorithm.hpp b/include/boost/range/algorithm/set_algorithm.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/sort.hpp b/include/boost/range/algorithm/sort.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/stable_partition.hpp b/include/boost/range/algorithm/stable_partition.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/stable_sort.hpp b/include/boost/range/algorithm/stable_sort.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/swap_ranges.hpp b/include/boost/range/algorithm/swap_ranges.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/transform.hpp b/include/boost/range/algorithm/transform.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/unique.hpp b/include/boost/range/algorithm/unique.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/unique_copy.hpp b/include/boost/range/algorithm/unique_copy.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm/upper_bound.hpp b/include/boost/range/algorithm/upper_bound.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext.hpp b/include/boost/range/algorithm_ext.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext/copy_n.hpp b/include/boost/range/algorithm_ext/copy_n.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext/erase.hpp b/include/boost/range/algorithm_ext/erase.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext/for_each.hpp b/include/boost/range/algorithm_ext/for_each.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext/insert.hpp b/include/boost/range/algorithm_ext/insert.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext/is_sorted.hpp b/include/boost/range/algorithm_ext/is_sorted.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext/overwrite.hpp b/include/boost/range/algorithm_ext/overwrite.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext/push_back.hpp b/include/boost/range/algorithm_ext/push_back.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/algorithm_ext/push_front.hpp b/include/boost/range/algorithm_ext/push_front.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/combine.hpp b/include/boost/range/combine.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/counting_range.hpp b/include/boost/range/counting_range.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/detail/demote_iterator_traversal_tag.hpp b/include/boost/range/detail/demote_iterator_traversal_tag.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/detail/extract_optional_type.hpp b/include/boost/range/detail/extract_optional_type.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/detail/misc_concept.hpp b/include/boost/range/detail/misc_concept.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/detail/range_return.hpp b/include/boost/range/detail/range_return.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/irange.hpp b/include/boost/range/irange.hpp index 8045550..3b5a6cc 100644 --- a/include/boost/range/irange.hpp +++ b/include/boost/range/irange.hpp @@ -124,13 +124,11 @@ namespace boost typedef typename base_t::difference_type difference_type; typedef typename base_t::reference reference; - integer_iterator_with_step(value_type first, value_type step, difference_type step_size) + integer_iterator_with_step(value_type first, difference_type step, value_type step_size) : m_first(first) , m_step(step) , m_step_size(step_size) { - BOOST_ASSERT( step >= 0 ); - BOOST_ASSERT( step_size != 0 ); } private: @@ -213,16 +211,18 @@ namespace boost { BOOST_ASSERT( step_size != 0 ); BOOST_ASSERT( (step_size > 0) ? (last >= first) : (last <= first) ); - + typedef typename range_detail::integer_iterator_with_step iterator_t; - const std::ptrdiff_t last_step - = (static_cast(last) - static_cast(first)) - / (static_cast(step_size)); - + const std::ptrdiff_t sz = static_cast(step_size >= 0 ? step_size : -step_size); + const Integer l = step_size >= 0 ? last : first; + const Integer f = step_size >= 0 ? first : last; + const std::ptrdiff_t num_steps = (l + ((l-f) % sz) - f) / sz; + BOOST_ASSERT(num_steps >= 0); + return strided_integer_range( iterator_t(first, 0, step_size), - iterator_t(first, last_step, step_size)); + iterator_t(first, num_steps, step_size)); } } // namespace boost diff --git a/include/boost/range/istream_range.hpp b/include/boost/range/istream_range.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/iterator_range_core.hpp b/include/boost/range/iterator_range_core.hpp old mode 100755 new mode 100644 index 438f38c..60c7670 --- a/include/boost/range/iterator_range_core.hpp +++ b/include/boost/range/iterator_range_core.hpp @@ -53,13 +53,13 @@ namespace boost template< class ForwardRange > static IteratorT adl_begin( ForwardRange& r ) { - return IteratorT( boost::begin( r ) ); + return static_cast( boost::begin( r ) ); } template< class ForwardRange > static IteratorT adl_end( ForwardRange& r ) { - return IteratorT( boost::end( r ) ); + return static_cast( boost::end( r ) ); } }; @@ -249,7 +249,7 @@ namespace boost difference_type size() const { - return m_End - m_Begin; + return m_End - m_Begin; } bool empty() const diff --git a/include/boost/range/iterator_range_io.hpp b/include/boost/range/iterator_range_io.hpp old mode 100755 new mode 100644 diff --git a/include/boost/range/join.hpp b/include/boost/range/join.hpp index ad0217e..aacc0a3 100644 --- a/include/boost/range/join.hpp +++ b/include/boost/range/join.hpp @@ -36,6 +36,9 @@ public: } // namespace range_detail +namespace range +{ + template class joined_range : public range_detail::joined_type::type @@ -78,6 +81,11 @@ join(SinglePassRange1& r1, SinglePassRange2& r2) return joined_range(r1, r2); } +} // namespace range + +using ::boost::range::joined_range; +using ::boost::range::join; + } // namespace boost #endif // include guard diff --git a/include/boost/range/numeric.hpp b/include/boost/range/numeric.hpp old mode 100755 new mode 100644