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