]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/compute/algorithm/equal.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / compute / algorithm / equal.hpp
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
10
11 #ifndef BOOST_COMPUTE_ALGORITHM_EQUAL_HPP
12 #define BOOST_COMPUTE_ALGORITHM_EQUAL_HPP
13
14 #include <boost/compute/system.hpp>
15 #include <boost/compute/command_queue.hpp>
16 #include <boost/compute/algorithm/mismatch.hpp>
17
18 namespace boost {
19 namespace compute {
20
21 /// Returns \c true if the range [\p first1, \p last1) and the range
22 /// beginning at \p first2 are equal.
23 ///
24 /// Space complexity: \Omega(1)
25 template<class InputIterator1, class InputIterator2>
26 inline bool equal(InputIterator1 first1,
27 InputIterator1 last1,
28 InputIterator2 first2,
29 command_queue &queue = system::default_queue())
30 {
31 return ::boost::compute::mismatch(first1,
32 last1,
33 first2,
34 queue).first == last1;
35 }
36
37 /// \overload
38 template<class InputIterator1, class InputIterator2>
39 inline bool equal(InputIterator1 first1,
40 InputIterator1 last1,
41 InputIterator2 first2,
42 InputIterator2 last2,
43 command_queue &queue = system::default_queue())
44 {
45 if(std::distance(first1, last1) != std::distance(first2, last2)){
46 return false;
47 }
48
49 return ::boost::compute::equal(first1, last1, first2, queue);
50 }
51
52 } // end compute namespace
53 } // end boost namespace
54
55 #endif // BOOST_COMPUTE_ALGORITHM_EQUAL_HPP