]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/compute/include/boost/compute/algorithm/equal.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / compute / include / 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 template<class InputIterator1, class InputIterator2>
24 inline bool equal(InputIterator1 first1,
25 InputIterator1 last1,
26 InputIterator2 first2,
27 command_queue &queue = system::default_queue())
28 {
29 return ::boost::compute::mismatch(first1,
30 last1,
31 first2,
32 queue).first == last1;
33 }
34
35 /// \overload
36 template<class InputIterator1, class InputIterator2>
37 inline bool equal(InputIterator1 first1,
38 InputIterator1 last1,
39 InputIterator2 first2,
40 InputIterator2 last2,
41 command_queue &queue = system::default_queue())
42 {
43 if(std::distance(first1, last1) != std::distance(first2, last2)){
44 return false;
45 }
46
47 return ::boost::compute::equal(first1, last1, first2, queue);
48 }
49
50 } // end compute namespace
51 } // end boost namespace
52
53 #endif // BOOST_COMPUTE_ALGORITHM_EQUAL_HPP