Removed use of deprecated header boost/detail/iterator.hpp.

This commit is contained in:
Andrey Semashev
2020-05-10 23:14:19 +03:00
parent c281caa89f
commit 63f2e170cb
2 changed files with 30 additions and 31 deletions

View File

@@ -1,11 +1,11 @@
// Copyright (c) 2000 David Abrahams. // Copyright (c) 2000 David Abrahams.
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
// Copyright (c) 1994 // Copyright (c) 1994
// Hewlett-Packard Company // Hewlett-Packard Company
// //
// Permission to use, copy, modify, distribute and sell this software // Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee, // and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all copies and // provided that the above copyright notice appear in all copies and
@@ -13,10 +13,10 @@
// in supporting documentation. Hewlett-Packard Company makes no // in supporting documentation. Hewlett-Packard Company makes no
// representations about the suitability of this software for any // representations about the suitability of this software for any
// purpose. It is provided "as is" without express or implied warranty. // purpose. It is provided "as is" without express or implied warranty.
// //
// Copyright (c) 1996 // Copyright (c) 1996
// Silicon Graphics Computer Systems, Inc. // Silicon Graphics Computer Systems, Inc.
// //
// Permission to use, copy, modify, distribute and sell this software // Permission to use, copy, modify, distribute and sell this software
// and its documentation for any purpose is hereby granted without fee, // and its documentation for any purpose is hereby granted without fee,
// provided that the above copyright notice appear in all copies and // provided that the above copyright notice appear in all copies and
@@ -24,22 +24,22 @@
// in supporting documentation. Silicon Graphics makes no // in supporting documentation. Silicon Graphics makes no
// representations about the suitability of this software for any // representations about the suitability of this software for any
// purpose. It is provided "as is" without express or implied warranty. // purpose. It is provided "as is" without express or implied warranty.
// //
#ifndef BINARY_SEARCH_DWA_122600_H_ #ifndef BINARY_SEARCH_DWA_122600_H_
# define BINARY_SEARCH_DWA_122600_H_ # define BINARY_SEARCH_DWA_122600_H_
# include <boost/detail/iterator.hpp>
# include <utility> # include <utility>
# include <iterator>
namespace boost { namespace detail { namespace boost { namespace detail {
template <class ForwardIter, class Tp> template <class ForwardIter, class Tp>
ForwardIter lower_bound(ForwardIter first, ForwardIter last, ForwardIter lower_bound(ForwardIter first, ForwardIter last,
const Tp& val) const Tp& val)
{ {
typedef detail::iterator_traits<ForwardIter> traits; typedef std::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last); typename traits::difference_type len = std::distance(first, last);
typename traits::difference_type half; typename traits::difference_type half;
ForwardIter middle; ForwardIter middle;
@@ -62,9 +62,9 @@ template <class ForwardIter, class Tp, class Compare>
ForwardIter lower_bound(ForwardIter first, ForwardIter last, ForwardIter lower_bound(ForwardIter first, ForwardIter last,
const Tp& val, Compare comp) const Tp& val, Compare comp)
{ {
typedef detail::iterator_traits<ForwardIter> traits; typedef std::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last); typename traits::difference_type len = std::distance(first, last);
typename traits::difference_type half; typename traits::difference_type half;
ForwardIter middle; ForwardIter middle;
@@ -87,9 +87,9 @@ template <class ForwardIter, class Tp>
ForwardIter upper_bound(ForwardIter first, ForwardIter last, ForwardIter upper_bound(ForwardIter first, ForwardIter last,
const Tp& val) const Tp& val)
{ {
typedef detail::iterator_traits<ForwardIter> traits; typedef std::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last); typename traits::difference_type len = std::distance(first, last);
typename traits::difference_type half; typename traits::difference_type half;
ForwardIter middle; ForwardIter middle;
@@ -112,9 +112,9 @@ template <class ForwardIter, class Tp, class Compare>
ForwardIter upper_bound(ForwardIter first, ForwardIter last, ForwardIter upper_bound(ForwardIter first, ForwardIter last,
const Tp& val, Compare comp) const Tp& val, Compare comp)
{ {
typedef detail::iterator_traits<ForwardIter> traits; typedef std::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last); typename traits::difference_type len = std::distance(first, last);
typename traits::difference_type half; typename traits::difference_type half;
ForwardIter middle; ForwardIter middle;
@@ -137,9 +137,9 @@ template <class ForwardIter, class Tp>
std::pair<ForwardIter, ForwardIter> std::pair<ForwardIter, ForwardIter>
equal_range(ForwardIter first, ForwardIter last, const Tp& val) equal_range(ForwardIter first, ForwardIter last, const Tp& val)
{ {
typedef detail::iterator_traits<ForwardIter> traits; typedef std::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last); typename traits::difference_type len = std::distance(first, last);
typename traits::difference_type half; typename traits::difference_type half;
ForwardIter middle, left, right; ForwardIter middle, left, right;
@@ -169,9 +169,9 @@ std::pair<ForwardIter, ForwardIter>
equal_range(ForwardIter first, ForwardIter last, const Tp& val, equal_range(ForwardIter first, ForwardIter last, const Tp& val,
Compare comp) Compare comp)
{ {
typedef detail::iterator_traits<ForwardIter> traits; typedef std::iterator_traits<ForwardIter> traits;
typename traits::difference_type len = boost::detail::distance(first, last); typename traits::difference_type len = std::distance(first, last);
typename traits::difference_type half; typename traits::difference_type half;
ForwardIter middle, left, right; ForwardIter middle, left, right;
@@ -194,7 +194,7 @@ equal_range(ForwardIter first, ForwardIter last, const Tp& val,
} }
} }
return std::pair<ForwardIter, ForwardIter>(first, first); return std::pair<ForwardIter, ForwardIter>(first, first);
} }
template <class ForwardIter, class Tp> template <class ForwardIter, class Tp>
bool binary_search(ForwardIter first, ForwardIter last, bool binary_search(ForwardIter first, ForwardIter last,

View File

@@ -8,8 +8,7 @@
#ifndef BOOST_DETAIL_SORTED_HPP #ifndef BOOST_DETAIL_SORTED_HPP
#define BOOST_DETAIL_SORTED_HPP #define BOOST_DETAIL_SORTED_HPP
#include <boost/detail/iterator.hpp> #include <iterator>
#include <functional> #include <functional>
namespace boost { namespace boost {
@@ -31,23 +30,23 @@ inline Iterator is_sorted_until (Iterator first, Iterator last, Comp c) {
template<class Iterator> template<class Iterator>
inline Iterator is_sorted_until (Iterator first, Iterator last) { inline Iterator is_sorted_until (Iterator first, Iterator last) {
typedef typename boost::detail::iterator_traits<Iterator>::value_type typedef typename std::iterator_traits<Iterator>::value_type
value_type; value_type;
typedef std::less<value_type> c; typedef std::less<value_type> c;
return ::boost::detail::is_sorted_until(first, last, c()); return ::boost::detail::is_sorted_until(first, last, c());
} }
template<class Iterator, class Comp> template<class Iterator, class Comp>
inline bool is_sorted (Iterator first, Iterator last, Comp c) { inline bool is_sorted (Iterator first, Iterator last, Comp c) {
return ::boost::detail::is_sorted_until(first, last, c) == last; return ::boost::detail::is_sorted_until(first, last, c) == last;
} }
template<class Iterator> template<class Iterator>
inline bool is_sorted (Iterator first, Iterator last) { inline bool is_sorted (Iterator first, Iterator last) {
return ::boost::detail::is_sorted_until(first, last) == last; return ::boost::detail::is_sorted_until(first, last) == last;
} }
} // detail } // detail
} // boost } // boost