* [PATCH, libstdc++] Implement C++20 p1032 default_searcher constexprosity.
@ 2019-11-15 20:16 Smith-Rowland, Edward M
2019-11-15 20:18 ` Ville Voutilainen
2019-11-15 20:29 ` Jonathan Wakely
0 siblings, 2 replies; 3+ messages in thread
From: Smith-Rowland, Edward M @ 2019-11-15 20:16 UTC (permalink / raw)
To: libstdc++, gcc-patches, jwakely
[-- Attachment #1: Type: text/plain, Size: 30 bytes --]
Pretty self-explanatory.
Ed
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: p1032_default_searcher.CL --]
[-- Type: text/x-opencl-src; name="p1032_default_searcher.CL", Size: 286 bytes --]
2019-11-15 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement the default_searcher part of C++20 p1032 Misc constexpr bits.
* include/std/functional
(default_searcher, default_searcher::operator()): Constexpr.
* testsuite/20_util/function_objects/constexpr_searcher.cc: New.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: p1032_default_searcher.patch --]
[-- Type: text/x-patch; name="p1032_default_searcher.patch", Size: 2621 bytes --]
Index: include/std/functional
===================================================================
--- include/std/functional (revision 278302)
+++ include/std/functional (working copy)
@@ -1000,6 +1000,7 @@
class default_searcher
{
public:
+ _GLIBCXX20_CONSTEXPR
default_searcher(_ForwardIterator1 __pat_first,
_ForwardIterator1 __pat_last,
_BinaryPredicate __pred = _BinaryPredicate())
@@ -1007,7 +1008,8 @@
{ }
template<typename _ForwardIterator2>
- pair<_ForwardIterator2, _ForwardIterator2>
+ _GLIBCXX20_CONSTEXPR
+ pair<_ForwardIterator2, _ForwardIterator2>
operator()(_ForwardIterator2 __first, _ForwardIterator2 __last) const
{
_ForwardIterator2 __first_ret =
Index: testsuite/20_util/function_objects/constexpr_searcher.cc
===================================================================
--- testsuite/20_util/function_objects/constexpr_searcher.cc (nonexistent)
+++ testsuite/20_util/function_objects/constexpr_searcher.cc (working copy)
@@ -0,0 +1,52 @@
+// Copyright (C) 2014-2019 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+#include <functional>
+#include <string_view>
+
+const std::string_view
+patt = "World";
+
+constexpr std::string_view
+greet = "Hello, Humongous World of Wonder!!!";
+
+const std::wstring_view
+wpatt = L"World";
+
+constexpr std::wstring_view
+wgreet = L"Hello, Humongous World of Wonder!!!";
+
+constexpr bool
+test_searcher()
+{
+ auto ok = true;
+
+ const std::default_searcher search(patt.begin(), patt.end(),
+ std::equal_to<>());
+ const auto find = search(greet.begin(), greet.end());
+
+ const std::default_searcher wsearch(wpatt.begin(), wpatt.end(),
+ std::equal_to<>());
+ const auto wfind = wsearch(wgreet.begin(), wgreet.end());
+
+ return ok;
+}
+
+static_assert(test_searcher());
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH, libstdc++] Implement C++20 p1032 default_searcher constexprosity.
2019-11-15 20:16 [PATCH, libstdc++] Implement C++20 p1032 default_searcher constexprosity Smith-Rowland, Edward M
@ 2019-11-15 20:18 ` Ville Voutilainen
2019-11-15 20:29 ` Jonathan Wakely
1 sibling, 0 replies; 3+ messages in thread
From: Ville Voutilainen @ 2019-11-15 20:18 UTC (permalink / raw)
To: Smith-Rowland, Edward M; +Cc: libstdc++, gcc-patches, jwakely
On Fri, 15 Nov 2019 at 22:16, Smith-Rowland, Edward M
<ESmith-rowland@alionscience.com> wrote:
>
> Pretty self-explanatory.
LGTM. Jonathan still needs to ack it.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH, libstdc++] Implement C++20 p1032 default_searcher constexprosity.
2019-11-15 20:16 [PATCH, libstdc++] Implement C++20 p1032 default_searcher constexprosity Smith-Rowland, Edward M
2019-11-15 20:18 ` Ville Voutilainen
@ 2019-11-15 20:29 ` Jonathan Wakely
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2019-11-15 20:29 UTC (permalink / raw)
To: Smith-Rowland, Edward M; +Cc: libstdc++, gcc-patches
On 15/11/19 20:15 +0000, Smith-Rowland, Edward M wrote:
>--- testsuite/20_util/function_objects/constexpr_searcher.cc (nonexistent)
>+++ testsuite/20_util/function_objects/constexpr_searcher.cc (working copy)
>@@ -0,0 +1,52 @@
>+// Copyright (C) 2014-2019 Free Software Foundation, Inc.
Just 2019 here, OK for trunk with that change. Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-15 20:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 20:16 [PATCH, libstdc++] Implement C++20 p1032 default_searcher constexprosity Smith-Rowland, Edward M
2019-11-15 20:18 ` Ville Voutilainen
2019-11-15 20:29 ` Jonathan Wakely
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).