Chris@16: // (C) Copyright Jeremy Siek 2001. Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompany- Chris@16: // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: /* Chris@16: * Chris@16: * Copyright (c) 1994 Chris@16: * Hewlett-Packard Company Chris@16: * Chris@16: * Permission to use, copy, modify, distribute and sell this software Chris@16: * and its documentation for any purpose is hereby granted without fee, Chris@16: * provided that the above copyright notice appear in all copies and Chris@16: * that both that copyright notice and this permission notice appear Chris@16: * in supporting documentation. Hewlett-Packard Company makes no Chris@16: * representations about the suitability of this software for any Chris@16: * purpose. It is provided "as is" without express or implied warranty. Chris@16: * Chris@16: * Chris@16: * Copyright (c) 1996 Chris@16: * Silicon Graphics Computer Systems, Inc. Chris@16: * Chris@16: * Permission to use, copy, modify, distribute and sell this software Chris@16: * and its documentation for any purpose is hereby granted without fee, Chris@16: * provided that the above copyright notice appear in all copies and Chris@16: * that both that copyright notice and this permission notice appear Chris@16: * in supporting documentation. Silicon Graphics makes no Chris@16: * representations about the suitability of this software for any Chris@16: * purpose. It is provided "as is" without express or implied warranty. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_ALGORITHM_HPP Chris@16: # define BOOST_ALGORITHM_HPP Chris@16: # include Chris@16: // Algorithms on sequences Chris@16: // Chris@16: // The functions in this file have not yet gone through formal Chris@16: // review, and are subject to change. This is a work in progress. Chris@16: // They have been checked into the detail directory because Chris@16: // there are some graph algorithms that use these functions. Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: template Chris@16: bool any_if(InputIterator first, InputIterator last, Predicate p) Chris@16: { Chris@16: return std::find_if(first, last, p) != last; Chris@16: } Chris@16: Chris@16: template Chris@16: bool any_if(const Container& c, Predicate p) Chris@16: { Chris@16: return any_if(boost::begin(c), boost::end(c), p); Chris@16: } Chris@16: Chris@16: template Chris@16: bool container_contains(InputIterator first, InputIterator last, T value) Chris@16: { Chris@16: return std::find(first, last, value) != last; Chris@16: } Chris@16: template Chris@16: bool container_contains(const Container& c, const T& value) Chris@16: { Chris@16: return container_contains(boost::begin(c), boost::end(c), value); Chris@16: } Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #endif // BOOST_ALGORITHM_HPP