public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Define new C++17 std::search overload for Parallel Mode [PR 94971]
Date: Wed, 4 Nov 2020 13:36:44 +0000	[thread overview]
Message-ID: <20201104133644.GA3201906@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

libstdc++-v3/ChangeLog:

	PR libstdc++/94971
	* include/bits/stl_algo.h (search(FIter, FIter, const Searcher):
	Adjust #if condition.
	* include/parallel/algo.h (search(FIter, FIter, const Searcher&):
	Define new overload for C++17.

Tested powerpc64le-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1987 bytes --]

commit e0af865ab9d9d5b6b3ac7fdde26cf9bbf635b6b4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Nov 4 13:36:32 2020

    libstdc++: Define new C++17 std::search overload for Parallel Mode [PR 94971]
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/94971
            * include/bits/stl_algo.h (search(FIter, FIter, const Searcher):
            Adjust #if condition.
            * include/parallel/algo.h (search(FIter, FIter, const Searcher&):
            Define new overload for C++17.

diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 621c6331422e..6efc99035b7d 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -4243,7 +4243,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
 		__gnu_cxx::__ops::__iter_comp_val(__binary_pred, __val));
     }
 
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
   /** @brief Search a sequence using a Searcher object.
    *
    *  @param  __first        A forward iterator.
diff --git a/libstdc++-v3/include/parallel/algo.h b/libstdc++-v3/include/parallel/algo.h
index cec6fd003c38..4b6dcc841191 100644
--- a/libstdc++-v3/include/parallel/algo.h
+++ b/libstdc++-v3/include/parallel/algo.h
@@ -1049,6 +1049,21 @@ namespace __parallel
 			     std::__iterator_category(__begin2));
     }
 
+#if __cplusplus >= 201703L
+  /** @brief Search a sequence using a Searcher object.
+   *
+   *  @param  __first        A forward iterator.
+   *  @param  __last         A forward iterator.
+   *  @param  __searcher     A callable object.
+   *  @return @p __searcher(__first,__last).first
+  */
+  template<typename _ForwardIterator, typename _Searcher>
+    inline _ForwardIterator
+    search(_ForwardIterator __first, _ForwardIterator __last,
+	   const _Searcher& __searcher)
+    { return __searcher(__first, __last).first; }
+#endif
+
   // Sequential fallback
   template<typename _FIterator, typename _Integer, typename _Tp>
     inline _FIterator

                 reply	other threads:[~2020-11-04 13:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201104133644.GA3201906@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).