Blame view

3rdparty/boost_1_81_0/boost/detail/algorithm.hpp 2.83 KB
63e88f80   Hu Chunming   提交三方库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
  // (C) Copyright Jeremy Siek 2001.
  // Distributed under the Boost Software License, Version 1.0. (See accompany-
  // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  
  /*
   *
   * Copyright (c) 1994
   * Hewlett-Packard Company
   *
   * Permission to use, copy, modify, distribute and sell this software
   * and its documentation for any purpose is hereby granted without fee,
   * provided that the above copyright notice appear in all copies and
   * that both that copyright notice and this permission notice appear
   * in supporting documentation.  Hewlett-Packard Company makes no
   * representations about the suitability of this software for any
   * purpose.  It is provided "as is" without express or implied warranty.
   *
   *
   * Copyright (c) 1996
   * Silicon Graphics Computer Systems, Inc.
   *
   * Permission to use, copy, modify, distribute and sell this software
   * and its documentation for any purpose is hereby granted without fee,
   * provided that the above copyright notice appear in all copies and
   * that both that copyright notice and this permission notice appear
   * in supporting documentation.  Silicon Graphics makes no
   * representations about the suitability of this software for any
   * purpose.  It is provided "as is" without express or implied warranty.
   */
  
  #ifndef BOOST_ALGORITHM_HPP
  #define BOOST_ALGORITHM_HPP
  
  // Algorithms on sequences
  //
  // The functions in this file have not yet gone through formal
  // review, and are subject to change. This is a work in progress.
  // They have been checked into the detail directory because
  // there are some graph algorithms that use these functions.
  
  #include <algorithm>
  #include <vector>
  #include <boost/range/begin.hpp>
  #include <boost/range/end.hpp>
  #include <boost/range/algorithm/copy.hpp>
  #include <boost/range/algorithm/equal.hpp>
  #include <boost/range/algorithm/sort.hpp>
  #include <boost/range/algorithm/stable_sort.hpp>
  #include <boost/range/algorithm/find_if.hpp>
  #include <boost/range/algorithm/count.hpp>
  #include <boost/range/algorithm/count_if.hpp>
  #include <boost/range/algorithm_ext/is_sorted.hpp>
  #include <boost/range/algorithm_ext/iota.hpp>
  
  namespace boost
  {
  
  template < typename InputIterator, typename Predicate >
  bool any_if(InputIterator first, InputIterator last, Predicate p)
  {
      return std::find_if(first, last, p) != last;
  }
  
  template < typename Container, typename Predicate >
  bool any_if(const Container& c, Predicate p)
  {
      return any_if(boost::begin(c), boost::end(c), p);
  }
  
  template < typename InputIterator, typename T >
  bool container_contains(InputIterator first, InputIterator last, T value)
  {
      return std::find(first, last, value) != last;
  }
  template < typename Container, typename T >
  bool container_contains(const Container& c, const T& value)
  {
      return container_contains(boost::begin(c), boost::end(c), value);
  }
  
  } // namespace boost
  
  #endif // BOOST_ALGORITHM_HPP