]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | |
f67539c2 | 32 | #define BOOST_ALGORITHM_HPP |
1e59de90 | 33 | |
7c673cae FG |
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 | ||
f67539c2 TL |
55 | namespace boost |
56 | { | |
7c673cae | 57 | |
f67539c2 TL |
58 | template < typename InputIterator, typename Predicate > |
59 | bool any_if(InputIterator first, InputIterator last, Predicate p) | |
60 | { | |
7c673cae | 61 | return std::find_if(first, last, p) != last; |
f67539c2 | 62 | } |
7c673cae | 63 | |
f67539c2 TL |
64 | template < typename Container, typename Predicate > |
65 | bool any_if(const Container& c, Predicate p) | |
66 | { | |
7c673cae | 67 | return any_if(boost::begin(c), boost::end(c), p); |
f67539c2 | 68 | } |
7c673cae | 69 | |
f67539c2 TL |
70 | template < typename InputIterator, typename T > |
71 | bool container_contains(InputIterator first, InputIterator last, T value) | |
72 | { | |
7c673cae | 73 | return std::find(first, last, value) != last; |
f67539c2 TL |
74 | } |
75 | template < typename Container, typename T > | |
76 | bool container_contains(const Container& c, const T& value) | |
77 | { | |
7c673cae | 78 | return container_contains(boost::begin(c), boost::end(c), value); |
f67539c2 | 79 | } |
7c673cae FG |
80 | |
81 | } // namespace boost | |
82 | ||
83 | #endif // BOOST_ALGORITHM_HPP |