* [PATCH] Add std::__is_byte<std::byte> specialization
@ 2018-06-27 10:30 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2018-06-27 10:30 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 374 bytes --]
* include/bits/cpp_type_traits.h [__cplusplus >= 201703]
(__is_byte<byte>): Define specialization for std::byte.
This is used in <algorithm> to decide whether to optimize fills to
memset, so we want to enable it for std::byte.
It could also be used to simplify __is_byte_like in <functional>,
which I might do at a later date.
Tested x86_64-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 907 bytes --]
commit 4f1f2fba9a43e5f63cb771f7c9c358734bbbd92a
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Jun 27 01:14:33 2018 +0100
Add std::__is_byte<std::byte> specialization
* include/bits/cpp_type_traits.h [__cplusplus >= 201703]
(__is_byte<byte>): Define specialization for std::byte.
diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index ed6de4696c7..960d469f412 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -391,6 +391,17 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3)
typedef __true_type __type;
};
+#if __cplusplus >= 201703L
+ enum class byte : unsigned char;
+
+ template<>
+ struct __is_byte<byte>
+ {
+ enum { __value = 1 };
+ typedef __true_type __type;
+ };
+#endif // C++17
+
//
// Move iterator type
//
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-06-27 10:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-27 10:30 [PATCH] Add std::__is_byte<std::byte> specialization 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).