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)
8 * Hewlett-Packard Company
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.
20 * Silicon Graphics Computer Systems, Inc.
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.
31 #ifndef BOOST_ALGORITHM_HPP
32 # define BOOST_ALGORITHM_HPP
33 # include <boost/detail/iterator.hpp>
34 // Algorithms on sequences
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.
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>
57 template <typename InputIterator, typename Predicate>
58 bool any_if(InputIterator first, InputIterator last, Predicate p)
60 return std::find_if(first, last, p) != last;
63 template <typename Container, typename Predicate>
64 bool any_if(const Container& c, Predicate p)
66 return any_if(boost::begin(c), boost::end(c), p);
69 template <typename InputIterator, typename T>
70 bool container_contains(InputIterator first, InputIterator last, T value)
72 return std::find(first, last, value) != last;
74 template <typename Container, typename T>
75 bool container_contains(const Container& c, const T& value)
77 return container_contains(boost::begin(c), boost::end(c), value);
82 #endif // BOOST_ALGORITHM_HPP