This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: parallel equal not parallel
- From: Johannes Singler <singler at kit dot edu>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: François Dumont <francois dot cppdevs at free dot fr>, libstdc++ at gcc dot gnu dot org
- Date: Mon, 24 Jan 2011 19:45:28 +0100
- Subject: Re: parallel equal not parallel
- References: <4CD31C38.7090703@free.fr> <4CD32B3F.8030309@oracle.com> <4CD43B20.2000908@kit.edu>
On 11/05/2010 06:13 PM, Johannes Singler wrote:
On 11/04/2010 10:53 PM, Paolo Carlini wrote:
On 11/04/2010 09:48 PM, François Dumont wrote:
So it uses the normal mismatch algo, IMO it should be:
template<typename _IIter1, typename _IIter2>
inline bool
equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2)
{
return mismatch(__begin1, __end1, __begin2).first == __end1;
}
template<typename _IIter1, typename _IIter2, typename _Predicate>
inline bool
equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
_Predicate __pred)
{
return mismatch(__begin1, __end1, __begin2, __pred).first ==
__end1;
}
Agree ?
Johannes?
Looks reasonable. I'm going to regression test this patch.
Well, I have an test case that fails to compile with this version
(ambiguity), when calling __gnu_parallel::equal (explicitly qualified).
Thus, I propose the attached patch. Does it still work for you then,
François?
Johannes
Index: include/parallel/algobase.h
===================================================================
--- include/parallel/algobase.h (revision 169160)
+++ include/parallel/algobase.h (working copy)
@@ -142,7 +142,8 @@
inline bool
equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2)
{
- return mismatch(__begin1, __end1, __begin2).first == __end1;
+ return __gnu_parallel::mismatch(__begin1, __end1, __begin2).first
+ == __end1;
}
// Public interface
@@ -151,7 +152,8 @@
equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
_Predicate __pred)
{
- return mismatch(__begin1, __end1, __begin2, __pred).first == __end1;
+ return __gnu_parallel::mismatch(__begin1, __end1, __begin2, __pred).first
+ == __end1;
}
// Sequential fallback