grpc 1.26.0 → 1.27.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +1654 -1519
- data/etc/roots.pem +44 -0
- data/include/grpc/grpc_security.h +37 -15
- data/include/grpc/grpc_security_constants.h +27 -0
- data/include/grpc/impl/codegen/grpc_types.h +14 -0
- data/include/grpc/impl/codegen/port_platform.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +0 -20
- data/src/core/ext/filters/client_channel/http_proxy.cc +4 -4
- data/src/core/ext/filters/client_channel/lb_policy.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +191 -201
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +88 -121
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +28 -57
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +0 -7
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +8 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +53 -34
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +18 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +24 -19
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +4 -2
- data/src/core/ext/filters/client_channel/server_address.cc +6 -9
- data/src/core/ext/filters/client_channel/server_address.h +3 -10
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +394 -150
- data/src/core/ext/filters/client_channel/xds/xds_api.h +75 -35
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +59 -22
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +13 -9
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +8 -6
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +456 -175
- data/src/core/ext/filters/client_channel/xds/xds_client.h +33 -21
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +5 -8
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +18 -24
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +2 -2
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +13 -5
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +34 -0
- data/src/core/lib/channel/channelz.h +11 -1
- data/src/core/lib/gpr/time_precise.cc +1 -1
- data/src/core/lib/gprpp/optional.h +26 -0
- data/src/core/lib/gprpp/string_view.h +14 -10
- data/src/core/lib/iomgr/executor.cc +1 -1
- data/src/core/lib/iomgr/fork_posix.cc +4 -0
- data/src/core/lib/iomgr/poller/eventmanager_libuv.cc +87 -0
- data/src/core/lib/iomgr/poller/eventmanager_libuv.h +88 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +14 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +12 -0
- data/src/core/lib/iomgr/tcp_custom.h +3 -0
- data/src/core/lib/iomgr/tcp_posix.cc +607 -56
- data/src/core/lib/iomgr/tcp_server_custom.cc +15 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +8 -0
- data/src/core/lib/json/json.h +11 -1
- data/src/core/lib/json/json_reader.cc +206 -28
- data/src/core/lib/json/json_writer.cc +111 -24
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +7 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +5 -1
- data/src/core/lib/security/credentials/credentials.h +10 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.h +2 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -1
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +20 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +8 -0
- data/src/core/lib/security/credentials/tls/{spiffe_credentials.cc → tls_credentials.cc} +23 -24
- data/src/core/lib/security/credentials/tls/{spiffe_credentials.h → tls_credentials.h} +9 -9
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +13 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +22 -2
- data/src/core/lib/security/security_connector/load_system_roots_fallback.cc +2 -2
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +2 -2
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +30 -3
- data/src/core/lib/security/security_connector/ssl_utils.cc +45 -3
- data/src/core/lib/security/security_connector/ssl_utils.h +12 -0
- data/src/core/lib/security/security_connector/tls/{spiffe_security_connector.cc → tls_security_connector.cc} +82 -69
- data/src/core/lib/security/security_connector/tls/{spiffe_security_connector.h → tls_security_connector.h} +17 -18
- data/src/core/lib/security/transport/client_auth_filter.cc +33 -0
- data/src/core/lib/surface/completion_queue.cc +22 -1
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +11 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +3 -3
- data/src/core/tsi/fake_transport_security.cc +7 -3
- data/src/core/tsi/fake_transport_security.h +2 -0
- data/src/core/tsi/ssl_transport_security.cc +144 -8
- data/src/core/tsi/ssl_transport_security.h +15 -1
- data/src/core/tsi/transport_security.cc +13 -0
- data/src/core/tsi/transport_security_grpc.cc +2 -2
- data/src/core/tsi/transport_security_grpc.h +2 -2
- data/src/core/tsi/transport_security_interface.h +12 -0
- data/src/ruby/bin/math_pb.rb +5 -5
- data/src/ruby/ext/grpc/rb_call_credentials.c +4 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +3 -3
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +23 -13
- data/third_party/abseil-cpp/absl/algorithm/algorithm.h +159 -0
- data/third_party/abseil-cpp/absl/base/attributes.h +609 -0
- data/third_party/abseil-cpp/absl/base/call_once.h +226 -0
- data/third_party/abseil-cpp/absl/base/casts.h +184 -0
- data/third_party/abseil-cpp/absl/base/config.h +622 -0
- data/third_party/abseil-cpp/absl/base/const_init.h +76 -0
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.cc +129 -0
- data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +389 -0
- data/third_party/abseil-cpp/absl/base/internal/atomic_hook.h +179 -0
- data/third_party/abseil-cpp/absl/base/internal/bits.h +218 -0
- data/third_party/abseil-cpp/absl/base/internal/cycleclock.cc +107 -0
- data/third_party/abseil-cpp/absl/base/internal/cycleclock.h +94 -0
- data/third_party/abseil-cpp/absl/base/internal/endian.h +266 -0
- data/third_party/abseil-cpp/absl/base/internal/hide_ptr.h +51 -0
- data/third_party/abseil-cpp/absl/base/internal/identity.h +37 -0
- data/third_party/abseil-cpp/absl/base/internal/inline_variable.h +107 -0
- data/third_party/abseil-cpp/absl/base/internal/invoke.h +187 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +107 -0
- data/third_party/abseil-cpp/absl/base/internal/per_thread_tls.h +52 -0
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +237 -0
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +179 -0
- data/third_party/abseil-cpp/absl/base/internal/scheduling_mode.h +58 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +233 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock.h +243 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc +35 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +67 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +46 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.cc +81 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +93 -0
- data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +37 -0
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +414 -0
- data/third_party/abseil-cpp/absl/base/internal/sysinfo.h +66 -0
- data/third_party/abseil-cpp/absl/base/internal/thread_annotations.h +271 -0
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +140 -0
- data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +250 -0
- data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +108 -0
- data/third_party/abseil-cpp/absl/base/internal/throw_delegate.h +75 -0
- data/third_party/abseil-cpp/absl/base/internal/tsan_mutex_interface.h +66 -0
- data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +158 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +103 -0
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +124 -0
- data/third_party/abseil-cpp/absl/base/log_severity.cc +27 -0
- data/third_party/abseil-cpp/absl/base/log_severity.h +121 -0
- data/third_party/abseil-cpp/absl/base/macros.h +220 -0
- data/third_party/abseil-cpp/absl/base/optimization.h +181 -0
- data/third_party/abseil-cpp/absl/base/options.h +214 -0
- data/third_party/abseil-cpp/absl/base/policy_checks.h +111 -0
- data/third_party/abseil-cpp/absl/base/port.h +26 -0
- data/third_party/abseil-cpp/absl/base/thread_annotations.h +280 -0
- data/third_party/abseil-cpp/absl/container/inlined_vector.h +848 -0
- data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +265 -0
- data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +892 -0
- data/third_party/abseil-cpp/absl/memory/memory.h +695 -0
- data/third_party/abseil-cpp/absl/meta/type_traits.h +759 -0
- data/third_party/abseil-cpp/absl/numeric/int128.cc +404 -0
- data/third_party/abseil-cpp/absl/numeric/int128.h +1091 -0
- data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +302 -0
- data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +308 -0
- data/third_party/abseil-cpp/absl/strings/ascii.cc +200 -0
- data/third_party/abseil-cpp/absl/strings/ascii.h +241 -0
- data/third_party/abseil-cpp/absl/strings/charconv.cc +985 -0
- data/third_party/abseil-cpp/absl/strings/charconv.h +119 -0
- data/third_party/abseil-cpp/absl/strings/escaping.cc +949 -0
- data/third_party/abseil-cpp/absl/strings/escaping.h +164 -0
- data/third_party/abseil-cpp/absl/strings/internal/char_map.h +156 -0
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +359 -0
- data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +421 -0
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +504 -0
- data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.h +99 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +180 -0
- data/third_party/abseil-cpp/absl/strings/internal/escaping.h +58 -0
- data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +112 -0
- data/third_party/abseil-cpp/absl/strings/internal/memutil.h +148 -0
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +36 -0
- data/third_party/abseil-cpp/absl/strings/internal/ostringstream.h +89 -0
- data/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h +73 -0
- data/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h +248 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_join_internal.h +314 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +455 -0
- data/third_party/abseil-cpp/absl/strings/internal/utf8.cc +53 -0
- data/third_party/abseil-cpp/absl/strings/internal/utf8.h +50 -0
- data/third_party/abseil-cpp/absl/strings/match.cc +40 -0
- data/third_party/abseil-cpp/absl/strings/match.h +90 -0
- data/third_party/abseil-cpp/absl/strings/numbers.cc +916 -0
- data/third_party/abseil-cpp/absl/strings/numbers.h +263 -0
- data/third_party/abseil-cpp/absl/strings/str_cat.cc +246 -0
- data/third_party/abseil-cpp/absl/strings/str_cat.h +408 -0
- data/third_party/abseil-cpp/absl/strings/str_join.h +293 -0
- data/third_party/abseil-cpp/absl/strings/str_replace.cc +82 -0
- data/third_party/abseil-cpp/absl/strings/str_replace.h +219 -0
- data/third_party/abseil-cpp/absl/strings/str_split.cc +139 -0
- data/third_party/abseil-cpp/absl/strings/str_split.h +513 -0
- data/third_party/abseil-cpp/absl/strings/string_view.cc +235 -0
- data/third_party/abseil-cpp/absl/strings/string_view.h +615 -0
- data/third_party/abseil-cpp/absl/strings/strip.h +91 -0
- data/third_party/abseil-cpp/absl/strings/substitute.cc +171 -0
- data/third_party/abseil-cpp/absl/strings/substitute.h +693 -0
- data/third_party/abseil-cpp/absl/types/bad_optional_access.cc +48 -0
- data/third_party/abseil-cpp/absl/types/bad_optional_access.h +78 -0
- data/third_party/abseil-cpp/absl/types/internal/optional.h +396 -0
- data/third_party/abseil-cpp/absl/types/internal/span.h +128 -0
- data/third_party/abseil-cpp/absl/types/optional.h +776 -0
- data/third_party/abseil-cpp/absl/types/span.h +713 -0
- data/third_party/abseil-cpp/absl/utility/utility.h +350 -0
- data/third_party/upb/upb/decode.c +4 -0
- data/third_party/upb/upb/port.c +0 -1
- data/third_party/upb/upb/port_def.inc +1 -3
- data/third_party/upb/upb/table.c +2 -1
- metadata +147 -43
- data/src/core/lib/json/json_common.h +0 -34
- data/src/core/lib/json/json_reader.h +0 -146
- data/src/core/lib/json/json_string.cc +0 -367
- data/src/core/lib/json/json_writer.h +0 -84
@@ -0,0 +1,148 @@
|
|
1
|
+
//
|
2
|
+
// Copyright 2017 The Abseil Authors.
|
3
|
+
//
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
// you may not use this file except in compliance with the License.
|
6
|
+
// You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
// See the License for the specific language governing permissions and
|
14
|
+
// limitations under the License.
|
15
|
+
//
|
16
|
+
|
17
|
+
// These routines provide mem versions of standard C string routines,
|
18
|
+
// such as strpbrk. They function exactly the same as the str versions,
|
19
|
+
// so if you wonder what they are, replace the word "mem" by
|
20
|
+
// "str" and check out the man page. I could return void*, as the
|
21
|
+
// strutil.h mem*() routines tend to do, but I return char* instead
|
22
|
+
// since this is by far the most common way these functions are called.
|
23
|
+
//
|
24
|
+
// The difference between the mem and str versions is the mem version
|
25
|
+
// takes a pointer and a length, rather than a '\0'-terminated string.
|
26
|
+
// The memcase* routines defined here assume the locale is "C"
|
27
|
+
// (they use absl::ascii_tolower instead of tolower).
|
28
|
+
//
|
29
|
+
// These routines are based on the BSD library.
|
30
|
+
//
|
31
|
+
// Here's a list of routines from string.h, and their mem analogues.
|
32
|
+
// Functions in lowercase are defined in string.h; those in UPPERCASE
|
33
|
+
// are defined here:
|
34
|
+
//
|
35
|
+
// strlen --
|
36
|
+
// strcat strncat MEMCAT
|
37
|
+
// strcpy strncpy memcpy
|
38
|
+
// -- memccpy (very cool function, btw)
|
39
|
+
// -- memmove
|
40
|
+
// -- memset
|
41
|
+
// strcmp strncmp memcmp
|
42
|
+
// strcasecmp strncasecmp MEMCASECMP
|
43
|
+
// strchr memchr
|
44
|
+
// strcoll --
|
45
|
+
// strxfrm --
|
46
|
+
// strdup strndup MEMDUP
|
47
|
+
// strrchr MEMRCHR
|
48
|
+
// strspn MEMSPN
|
49
|
+
// strcspn MEMCSPN
|
50
|
+
// strpbrk MEMPBRK
|
51
|
+
// strstr MEMSTR MEMMEM
|
52
|
+
// (g)strcasestr MEMCASESTR MEMCASEMEM
|
53
|
+
// strtok --
|
54
|
+
// strprefix MEMPREFIX (strprefix is from strutil.h)
|
55
|
+
// strcaseprefix MEMCASEPREFIX (strcaseprefix is from strutil.h)
|
56
|
+
// strsuffix MEMSUFFIX (strsuffix is from strutil.h)
|
57
|
+
// strcasesuffix MEMCASESUFFIX (strcasesuffix is from strutil.h)
|
58
|
+
// -- MEMIS
|
59
|
+
// -- MEMCASEIS
|
60
|
+
// strcount MEMCOUNT (strcount is from strutil.h)
|
61
|
+
|
62
|
+
#ifndef ABSL_STRINGS_INTERNAL_MEMUTIL_H_
|
63
|
+
#define ABSL_STRINGS_INTERNAL_MEMUTIL_H_
|
64
|
+
|
65
|
+
#include <cstddef>
|
66
|
+
#include <cstring>
|
67
|
+
|
68
|
+
#include "absl/base/port.h" // disable some warnings on Windows
|
69
|
+
#include "absl/strings/ascii.h" // for absl::ascii_tolower
|
70
|
+
|
71
|
+
namespace absl {
|
72
|
+
ABSL_NAMESPACE_BEGIN
|
73
|
+
namespace strings_internal {
|
74
|
+
|
75
|
+
inline char* memcat(char* dest, size_t destlen, const char* src,
|
76
|
+
size_t srclen) {
|
77
|
+
return reinterpret_cast<char*>(memcpy(dest + destlen, src, srclen));
|
78
|
+
}
|
79
|
+
|
80
|
+
int memcasecmp(const char* s1, const char* s2, size_t len);
|
81
|
+
char* memdup(const char* s, size_t slen);
|
82
|
+
char* memrchr(const char* s, int c, size_t slen);
|
83
|
+
size_t memspn(const char* s, size_t slen, const char* accept);
|
84
|
+
size_t memcspn(const char* s, size_t slen, const char* reject);
|
85
|
+
char* mempbrk(const char* s, size_t slen, const char* accept);
|
86
|
+
|
87
|
+
// This is for internal use only. Don't call this directly
|
88
|
+
template <bool case_sensitive>
|
89
|
+
const char* int_memmatch(const char* haystack, size_t haylen,
|
90
|
+
const char* needle, size_t neelen) {
|
91
|
+
if (0 == neelen) {
|
92
|
+
return haystack; // even if haylen is 0
|
93
|
+
}
|
94
|
+
const char* hayend = haystack + haylen;
|
95
|
+
const char* needlestart = needle;
|
96
|
+
const char* needleend = needlestart + neelen;
|
97
|
+
|
98
|
+
for (; haystack < hayend; ++haystack) {
|
99
|
+
char hay = case_sensitive
|
100
|
+
? *haystack
|
101
|
+
: absl::ascii_tolower(static_cast<unsigned char>(*haystack));
|
102
|
+
char nee = case_sensitive
|
103
|
+
? *needle
|
104
|
+
: absl::ascii_tolower(static_cast<unsigned char>(*needle));
|
105
|
+
if (hay == nee) {
|
106
|
+
if (++needle == needleend) {
|
107
|
+
return haystack + 1 - neelen;
|
108
|
+
}
|
109
|
+
} else if (needle != needlestart) {
|
110
|
+
// must back up haystack in case a prefix matched (find "aab" in "aaab")
|
111
|
+
haystack -= needle - needlestart; // for loop will advance one more
|
112
|
+
needle = needlestart;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return nullptr;
|
116
|
+
}
|
117
|
+
|
118
|
+
// These are the guys you can call directly
|
119
|
+
inline const char* memstr(const char* phaystack, size_t haylen,
|
120
|
+
const char* pneedle) {
|
121
|
+
return int_memmatch<true>(phaystack, haylen, pneedle, strlen(pneedle));
|
122
|
+
}
|
123
|
+
|
124
|
+
inline const char* memcasestr(const char* phaystack, size_t haylen,
|
125
|
+
const char* pneedle) {
|
126
|
+
return int_memmatch<false>(phaystack, haylen, pneedle, strlen(pneedle));
|
127
|
+
}
|
128
|
+
|
129
|
+
inline const char* memmem(const char* phaystack, size_t haylen,
|
130
|
+
const char* pneedle, size_t needlelen) {
|
131
|
+
return int_memmatch<true>(phaystack, haylen, pneedle, needlelen);
|
132
|
+
}
|
133
|
+
|
134
|
+
inline const char* memcasemem(const char* phaystack, size_t haylen,
|
135
|
+
const char* pneedle, size_t needlelen) {
|
136
|
+
return int_memmatch<false>(phaystack, haylen, pneedle, needlelen);
|
137
|
+
}
|
138
|
+
|
139
|
+
// This is significantly faster for case-sensitive matches with very
|
140
|
+
// few possible matches. See unit test for benchmarks.
|
141
|
+
const char* memmatch(const char* phaystack, size_t haylen, const char* pneedle,
|
142
|
+
size_t neelen);
|
143
|
+
|
144
|
+
} // namespace strings_internal
|
145
|
+
ABSL_NAMESPACE_END
|
146
|
+
} // namespace absl
|
147
|
+
|
148
|
+
#endif // ABSL_STRINGS_INTERNAL_MEMUTIL_H_
|
@@ -0,0 +1,36 @@
|
|
1
|
+
// Copyright 2017 The Abseil Authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#include "absl/strings/internal/ostringstream.h"
|
16
|
+
|
17
|
+
namespace absl {
|
18
|
+
ABSL_NAMESPACE_BEGIN
|
19
|
+
namespace strings_internal {
|
20
|
+
|
21
|
+
OStringStream::Buf::int_type OStringStream::overflow(int c) {
|
22
|
+
assert(s_);
|
23
|
+
if (!Buf::traits_type::eq_int_type(c, Buf::traits_type::eof()))
|
24
|
+
s_->push_back(static_cast<char>(c));
|
25
|
+
return 1;
|
26
|
+
}
|
27
|
+
|
28
|
+
std::streamsize OStringStream::xsputn(const char* s, std::streamsize n) {
|
29
|
+
assert(s_);
|
30
|
+
s_->append(s, n);
|
31
|
+
return n;
|
32
|
+
}
|
33
|
+
|
34
|
+
} // namespace strings_internal
|
35
|
+
ABSL_NAMESPACE_END
|
36
|
+
} // namespace absl
|
@@ -0,0 +1,89 @@
|
|
1
|
+
// Copyright 2017 The Abseil Authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#ifndef ABSL_STRINGS_INTERNAL_OSTRINGSTREAM_H_
|
16
|
+
#define ABSL_STRINGS_INTERNAL_OSTRINGSTREAM_H_
|
17
|
+
|
18
|
+
#include <cassert>
|
19
|
+
#include <ostream>
|
20
|
+
#include <streambuf>
|
21
|
+
#include <string>
|
22
|
+
|
23
|
+
#include "absl/base/port.h"
|
24
|
+
|
25
|
+
namespace absl {
|
26
|
+
ABSL_NAMESPACE_BEGIN
|
27
|
+
namespace strings_internal {
|
28
|
+
|
29
|
+
// The same as std::ostringstream but appends to a user-specified std::string,
|
30
|
+
// and is faster. It is ~70% faster to create, ~50% faster to write to, and
|
31
|
+
// completely free to extract the result std::string.
|
32
|
+
//
|
33
|
+
// std::string s;
|
34
|
+
// OStringStream strm(&s);
|
35
|
+
// strm << 42 << ' ' << 3.14; // appends to `s`
|
36
|
+
//
|
37
|
+
// The stream object doesn't have to be named. Starting from C++11 operator<<
|
38
|
+
// works with rvalues of std::ostream.
|
39
|
+
//
|
40
|
+
// std::string s;
|
41
|
+
// OStringStream(&s) << 42 << ' ' << 3.14; // appends to `s`
|
42
|
+
//
|
43
|
+
// OStringStream is faster to create than std::ostringstream but it's still
|
44
|
+
// relatively slow. Avoid creating multiple streams where a single stream will
|
45
|
+
// do.
|
46
|
+
//
|
47
|
+
// Creates unnecessary instances of OStringStream: slow.
|
48
|
+
//
|
49
|
+
// std::string s;
|
50
|
+
// OStringStream(&s) << 42;
|
51
|
+
// OStringStream(&s) << ' ';
|
52
|
+
// OStringStream(&s) << 3.14;
|
53
|
+
//
|
54
|
+
// Creates a single instance of OStringStream and reuses it: fast.
|
55
|
+
//
|
56
|
+
// std::string s;
|
57
|
+
// OStringStream strm(&s);
|
58
|
+
// strm << 42;
|
59
|
+
// strm << ' ';
|
60
|
+
// strm << 3.14;
|
61
|
+
//
|
62
|
+
// Note: flush() has no effect. No reason to call it.
|
63
|
+
class OStringStream : private std::basic_streambuf<char>, public std::ostream {
|
64
|
+
public:
|
65
|
+
// The argument can be null, in which case you'll need to call str(p) with a
|
66
|
+
// non-null argument before you can write to the stream.
|
67
|
+
//
|
68
|
+
// The destructor of OStringStream doesn't use the std::string. It's OK to
|
69
|
+
// destroy the std::string before the stream.
|
70
|
+
explicit OStringStream(std::string* s) : std::ostream(this), s_(s) {}
|
71
|
+
|
72
|
+
std::string* str() { return s_; }
|
73
|
+
const std::string* str() const { return s_; }
|
74
|
+
void str(std::string* s) { s_ = s; }
|
75
|
+
|
76
|
+
private:
|
77
|
+
using Buf = std::basic_streambuf<char>;
|
78
|
+
|
79
|
+
Buf::int_type overflow(int c) override;
|
80
|
+
std::streamsize xsputn(const char* s, std::streamsize n) override;
|
81
|
+
|
82
|
+
std::string* s_;
|
83
|
+
};
|
84
|
+
|
85
|
+
} // namespace strings_internal
|
86
|
+
ABSL_NAMESPACE_END
|
87
|
+
} // namespace absl
|
88
|
+
|
89
|
+
#endif // ABSL_STRINGS_INTERNAL_OSTRINGSTREAM_H_
|
@@ -0,0 +1,73 @@
|
|
1
|
+
//
|
2
|
+
// Copyright 2017 The Abseil Authors.
|
3
|
+
//
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
// you may not use this file except in compliance with the License.
|
6
|
+
// You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
// See the License for the specific language governing permissions and
|
14
|
+
// limitations under the License.
|
15
|
+
//
|
16
|
+
|
17
|
+
#ifndef ABSL_STRINGS_INTERNAL_RESIZE_UNINITIALIZED_H_
|
18
|
+
#define ABSL_STRINGS_INTERNAL_RESIZE_UNINITIALIZED_H_
|
19
|
+
|
20
|
+
#include <string>
|
21
|
+
#include <type_traits>
|
22
|
+
#include <utility>
|
23
|
+
|
24
|
+
#include "absl/base/port.h"
|
25
|
+
#include "absl/meta/type_traits.h" // for void_t
|
26
|
+
|
27
|
+
namespace absl {
|
28
|
+
ABSL_NAMESPACE_BEGIN
|
29
|
+
namespace strings_internal {
|
30
|
+
|
31
|
+
// Is a subclass of true_type or false_type, depending on whether or not
|
32
|
+
// T has a __resize_default_init member.
|
33
|
+
template <typename string_type, typename = void>
|
34
|
+
struct ResizeUninitializedTraits {
|
35
|
+
using HasMember = std::false_type;
|
36
|
+
static void Resize(string_type* s, size_t new_size) { s->resize(new_size); }
|
37
|
+
};
|
38
|
+
|
39
|
+
// __resize_default_init is provided by libc++ >= 8.0
|
40
|
+
template <typename string_type>
|
41
|
+
struct ResizeUninitializedTraits<
|
42
|
+
string_type, absl::void_t<decltype(std::declval<string_type&>()
|
43
|
+
.__resize_default_init(237))> > {
|
44
|
+
using HasMember = std::true_type;
|
45
|
+
static void Resize(string_type* s, size_t new_size) {
|
46
|
+
s->__resize_default_init(new_size);
|
47
|
+
}
|
48
|
+
};
|
49
|
+
|
50
|
+
// Returns true if the std::string implementation supports a resize where
|
51
|
+
// the new characters added to the std::string are left untouched.
|
52
|
+
//
|
53
|
+
// (A better name might be "STLStringSupportsUninitializedResize", alluding to
|
54
|
+
// the previous function.)
|
55
|
+
template <typename string_type>
|
56
|
+
inline constexpr bool STLStringSupportsNontrashingResize(string_type*) {
|
57
|
+
return ResizeUninitializedTraits<string_type>::HasMember::value;
|
58
|
+
}
|
59
|
+
|
60
|
+
// Like str->resize(new_size), except any new characters added to "*str" as a
|
61
|
+
// result of resizing may be left uninitialized, rather than being filled with
|
62
|
+
// '0' bytes. Typically used when code is then going to overwrite the backing
|
63
|
+
// store of the std::string with known data.
|
64
|
+
template <typename string_type, typename = void>
|
65
|
+
inline void STLStringResizeUninitialized(string_type* s, size_t new_size) {
|
66
|
+
ResizeUninitializedTraits<string_type>::Resize(s, new_size);
|
67
|
+
}
|
68
|
+
|
69
|
+
} // namespace strings_internal
|
70
|
+
ABSL_NAMESPACE_END
|
71
|
+
} // namespace absl
|
72
|
+
|
73
|
+
#endif // ABSL_STRINGS_INTERNAL_RESIZE_UNINITIALIZED_H_
|
@@ -0,0 +1,248 @@
|
|
1
|
+
// Copyright 2017 The Abseil Authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
//
|
15
|
+
|
16
|
+
// Thie file provides the IsStrictlyBaseOfAndConvertibleToSTLContainer type
|
17
|
+
// trait metafunction to assist in working with the _GLIBCXX_DEBUG debug
|
18
|
+
// wrappers of STL containers.
|
19
|
+
//
|
20
|
+
// DO NOT INCLUDE THIS FILE DIRECTLY. Use this file by including
|
21
|
+
// absl/strings/str_split.h.
|
22
|
+
//
|
23
|
+
// IWYU pragma: private, include "absl/strings/str_split.h"
|
24
|
+
|
25
|
+
#ifndef ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_
|
26
|
+
#define ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_
|
27
|
+
|
28
|
+
#include <array>
|
29
|
+
#include <bitset>
|
30
|
+
#include <deque>
|
31
|
+
#include <forward_list>
|
32
|
+
#include <list>
|
33
|
+
#include <map>
|
34
|
+
#include <set>
|
35
|
+
#include <type_traits>
|
36
|
+
#include <unordered_map>
|
37
|
+
#include <unordered_set>
|
38
|
+
#include <vector>
|
39
|
+
|
40
|
+
#include "absl/meta/type_traits.h"
|
41
|
+
|
42
|
+
namespace absl {
|
43
|
+
ABSL_NAMESPACE_BEGIN
|
44
|
+
namespace strings_internal {
|
45
|
+
|
46
|
+
template <typename C, template <typename...> class T>
|
47
|
+
struct IsSpecializationImpl : std::false_type {};
|
48
|
+
template <template <typename...> class T, typename... Args>
|
49
|
+
struct IsSpecializationImpl<T<Args...>, T> : std::true_type {};
|
50
|
+
template <typename C, template <typename...> class T>
|
51
|
+
using IsSpecialization = IsSpecializationImpl<absl::decay_t<C>, T>;
|
52
|
+
|
53
|
+
template <typename C>
|
54
|
+
struct IsArrayImpl : std::false_type {};
|
55
|
+
template <template <typename, size_t> class A, typename T, size_t N>
|
56
|
+
struct IsArrayImpl<A<T, N>> : std::is_same<A<T, N>, std::array<T, N>> {};
|
57
|
+
template <typename C>
|
58
|
+
using IsArray = IsArrayImpl<absl::decay_t<C>>;
|
59
|
+
|
60
|
+
template <typename C>
|
61
|
+
struct IsBitsetImpl : std::false_type {};
|
62
|
+
template <template <size_t> class B, size_t N>
|
63
|
+
struct IsBitsetImpl<B<N>> : std::is_same<B<N>, std::bitset<N>> {};
|
64
|
+
template <typename C>
|
65
|
+
using IsBitset = IsBitsetImpl<absl::decay_t<C>>;
|
66
|
+
|
67
|
+
template <typename C>
|
68
|
+
struct IsSTLContainer
|
69
|
+
: absl::disjunction<
|
70
|
+
IsArray<C>, IsBitset<C>, IsSpecialization<C, std::deque>,
|
71
|
+
IsSpecialization<C, std::forward_list>,
|
72
|
+
IsSpecialization<C, std::list>, IsSpecialization<C, std::map>,
|
73
|
+
IsSpecialization<C, std::multimap>, IsSpecialization<C, std::set>,
|
74
|
+
IsSpecialization<C, std::multiset>,
|
75
|
+
IsSpecialization<C, std::unordered_map>,
|
76
|
+
IsSpecialization<C, std::unordered_multimap>,
|
77
|
+
IsSpecialization<C, std::unordered_set>,
|
78
|
+
IsSpecialization<C, std::unordered_multiset>,
|
79
|
+
IsSpecialization<C, std::vector>> {};
|
80
|
+
|
81
|
+
template <typename C, template <typename...> class T, typename = void>
|
82
|
+
struct IsBaseOfSpecializationImpl : std::false_type {};
|
83
|
+
// IsBaseOfSpecializationImpl needs multiple partial specializations to SFINAE
|
84
|
+
// on the existence of container dependent types and plug them into the STL
|
85
|
+
// template.
|
86
|
+
template <typename C, template <typename, typename> class T>
|
87
|
+
struct IsBaseOfSpecializationImpl<
|
88
|
+
C, T, absl::void_t<typename C::value_type, typename C::allocator_type>>
|
89
|
+
: std::is_base_of<C,
|
90
|
+
T<typename C::value_type, typename C::allocator_type>> {};
|
91
|
+
template <typename C, template <typename, typename, typename> class T>
|
92
|
+
struct IsBaseOfSpecializationImpl<
|
93
|
+
C, T,
|
94
|
+
absl::void_t<typename C::key_type, typename C::key_compare,
|
95
|
+
typename C::allocator_type>>
|
96
|
+
: std::is_base_of<C, T<typename C::key_type, typename C::key_compare,
|
97
|
+
typename C::allocator_type>> {};
|
98
|
+
template <typename C, template <typename, typename, typename, typename> class T>
|
99
|
+
struct IsBaseOfSpecializationImpl<
|
100
|
+
C, T,
|
101
|
+
absl::void_t<typename C::key_type, typename C::mapped_type,
|
102
|
+
typename C::key_compare, typename C::allocator_type>>
|
103
|
+
: std::is_base_of<C,
|
104
|
+
T<typename C::key_type, typename C::mapped_type,
|
105
|
+
typename C::key_compare, typename C::allocator_type>> {
|
106
|
+
};
|
107
|
+
template <typename C, template <typename, typename, typename, typename> class T>
|
108
|
+
struct IsBaseOfSpecializationImpl<
|
109
|
+
C, T,
|
110
|
+
absl::void_t<typename C::key_type, typename C::hasher,
|
111
|
+
typename C::key_equal, typename C::allocator_type>>
|
112
|
+
: std::is_base_of<C, T<typename C::key_type, typename C::hasher,
|
113
|
+
typename C::key_equal, typename C::allocator_type>> {
|
114
|
+
};
|
115
|
+
template <typename C,
|
116
|
+
template <typename, typename, typename, typename, typename> class T>
|
117
|
+
struct IsBaseOfSpecializationImpl<
|
118
|
+
C, T,
|
119
|
+
absl::void_t<typename C::key_type, typename C::mapped_type,
|
120
|
+
typename C::hasher, typename C::key_equal,
|
121
|
+
typename C::allocator_type>>
|
122
|
+
: std::is_base_of<C, T<typename C::key_type, typename C::mapped_type,
|
123
|
+
typename C::hasher, typename C::key_equal,
|
124
|
+
typename C::allocator_type>> {};
|
125
|
+
template <typename C, template <typename...> class T>
|
126
|
+
using IsBaseOfSpecialization = IsBaseOfSpecializationImpl<absl::decay_t<C>, T>;
|
127
|
+
|
128
|
+
template <typename C>
|
129
|
+
struct IsBaseOfArrayImpl : std::false_type {};
|
130
|
+
template <template <typename, size_t> class A, typename T, size_t N>
|
131
|
+
struct IsBaseOfArrayImpl<A<T, N>> : std::is_base_of<A<T, N>, std::array<T, N>> {
|
132
|
+
};
|
133
|
+
template <typename C>
|
134
|
+
using IsBaseOfArray = IsBaseOfArrayImpl<absl::decay_t<C>>;
|
135
|
+
|
136
|
+
template <typename C>
|
137
|
+
struct IsBaseOfBitsetImpl : std::false_type {};
|
138
|
+
template <template <size_t> class B, size_t N>
|
139
|
+
struct IsBaseOfBitsetImpl<B<N>> : std::is_base_of<B<N>, std::bitset<N>> {};
|
140
|
+
template <typename C>
|
141
|
+
using IsBaseOfBitset = IsBaseOfBitsetImpl<absl::decay_t<C>>;
|
142
|
+
|
143
|
+
template <typename C>
|
144
|
+
struct IsBaseOfSTLContainer
|
145
|
+
: absl::disjunction<IsBaseOfArray<C>, IsBaseOfBitset<C>,
|
146
|
+
IsBaseOfSpecialization<C, std::deque>,
|
147
|
+
IsBaseOfSpecialization<C, std::forward_list>,
|
148
|
+
IsBaseOfSpecialization<C, std::list>,
|
149
|
+
IsBaseOfSpecialization<C, std::map>,
|
150
|
+
IsBaseOfSpecialization<C, std::multimap>,
|
151
|
+
IsBaseOfSpecialization<C, std::set>,
|
152
|
+
IsBaseOfSpecialization<C, std::multiset>,
|
153
|
+
IsBaseOfSpecialization<C, std::unordered_map>,
|
154
|
+
IsBaseOfSpecialization<C, std::unordered_multimap>,
|
155
|
+
IsBaseOfSpecialization<C, std::unordered_set>,
|
156
|
+
IsBaseOfSpecialization<C, std::unordered_multiset>,
|
157
|
+
IsBaseOfSpecialization<C, std::vector>> {};
|
158
|
+
|
159
|
+
template <typename C, template <typename...> class T, typename = void>
|
160
|
+
struct IsConvertibleToSpecializationImpl : std::false_type {};
|
161
|
+
// IsConvertibleToSpecializationImpl needs multiple partial specializations to
|
162
|
+
// SFINAE on the existence of container dependent types and plug them into the
|
163
|
+
// STL template.
|
164
|
+
template <typename C, template <typename, typename> class T>
|
165
|
+
struct IsConvertibleToSpecializationImpl<
|
166
|
+
C, T, absl::void_t<typename C::value_type, typename C::allocator_type>>
|
167
|
+
: std::is_convertible<
|
168
|
+
C, T<typename C::value_type, typename C::allocator_type>> {};
|
169
|
+
template <typename C, template <typename, typename, typename> class T>
|
170
|
+
struct IsConvertibleToSpecializationImpl<
|
171
|
+
C, T,
|
172
|
+
absl::void_t<typename C::key_type, typename C::key_compare,
|
173
|
+
typename C::allocator_type>>
|
174
|
+
: std::is_convertible<C, T<typename C::key_type, typename C::key_compare,
|
175
|
+
typename C::allocator_type>> {};
|
176
|
+
template <typename C, template <typename, typename, typename, typename> class T>
|
177
|
+
struct IsConvertibleToSpecializationImpl<
|
178
|
+
C, T,
|
179
|
+
absl::void_t<typename C::key_type, typename C::mapped_type,
|
180
|
+
typename C::key_compare, typename C::allocator_type>>
|
181
|
+
: std::is_convertible<
|
182
|
+
C, T<typename C::key_type, typename C::mapped_type,
|
183
|
+
typename C::key_compare, typename C::allocator_type>> {};
|
184
|
+
template <typename C, template <typename, typename, typename, typename> class T>
|
185
|
+
struct IsConvertibleToSpecializationImpl<
|
186
|
+
C, T,
|
187
|
+
absl::void_t<typename C::key_type, typename C::hasher,
|
188
|
+
typename C::key_equal, typename C::allocator_type>>
|
189
|
+
: std::is_convertible<
|
190
|
+
C, T<typename C::key_type, typename C::hasher, typename C::key_equal,
|
191
|
+
typename C::allocator_type>> {};
|
192
|
+
template <typename C,
|
193
|
+
template <typename, typename, typename, typename, typename> class T>
|
194
|
+
struct IsConvertibleToSpecializationImpl<
|
195
|
+
C, T,
|
196
|
+
absl::void_t<typename C::key_type, typename C::mapped_type,
|
197
|
+
typename C::hasher, typename C::key_equal,
|
198
|
+
typename C::allocator_type>>
|
199
|
+
: std::is_convertible<C, T<typename C::key_type, typename C::mapped_type,
|
200
|
+
typename C::hasher, typename C::key_equal,
|
201
|
+
typename C::allocator_type>> {};
|
202
|
+
template <typename C, template <typename...> class T>
|
203
|
+
using IsConvertibleToSpecialization =
|
204
|
+
IsConvertibleToSpecializationImpl<absl::decay_t<C>, T>;
|
205
|
+
|
206
|
+
template <typename C>
|
207
|
+
struct IsConvertibleToArrayImpl : std::false_type {};
|
208
|
+
template <template <typename, size_t> class A, typename T, size_t N>
|
209
|
+
struct IsConvertibleToArrayImpl<A<T, N>>
|
210
|
+
: std::is_convertible<A<T, N>, std::array<T, N>> {};
|
211
|
+
template <typename C>
|
212
|
+
using IsConvertibleToArray = IsConvertibleToArrayImpl<absl::decay_t<C>>;
|
213
|
+
|
214
|
+
template <typename C>
|
215
|
+
struct IsConvertibleToBitsetImpl : std::false_type {};
|
216
|
+
template <template <size_t> class B, size_t N>
|
217
|
+
struct IsConvertibleToBitsetImpl<B<N>>
|
218
|
+
: std::is_convertible<B<N>, std::bitset<N>> {};
|
219
|
+
template <typename C>
|
220
|
+
using IsConvertibleToBitset = IsConvertibleToBitsetImpl<absl::decay_t<C>>;
|
221
|
+
|
222
|
+
template <typename C>
|
223
|
+
struct IsConvertibleToSTLContainer
|
224
|
+
: absl::disjunction<
|
225
|
+
IsConvertibleToArray<C>, IsConvertibleToBitset<C>,
|
226
|
+
IsConvertibleToSpecialization<C, std::deque>,
|
227
|
+
IsConvertibleToSpecialization<C, std::forward_list>,
|
228
|
+
IsConvertibleToSpecialization<C, std::list>,
|
229
|
+
IsConvertibleToSpecialization<C, std::map>,
|
230
|
+
IsConvertibleToSpecialization<C, std::multimap>,
|
231
|
+
IsConvertibleToSpecialization<C, std::set>,
|
232
|
+
IsConvertibleToSpecialization<C, std::multiset>,
|
233
|
+
IsConvertibleToSpecialization<C, std::unordered_map>,
|
234
|
+
IsConvertibleToSpecialization<C, std::unordered_multimap>,
|
235
|
+
IsConvertibleToSpecialization<C, std::unordered_set>,
|
236
|
+
IsConvertibleToSpecialization<C, std::unordered_multiset>,
|
237
|
+
IsConvertibleToSpecialization<C, std::vector>> {};
|
238
|
+
|
239
|
+
template <typename C>
|
240
|
+
struct IsStrictlyBaseOfAndConvertibleToSTLContainer
|
241
|
+
: absl::conjunction<absl::negation<IsSTLContainer<C>>,
|
242
|
+
IsBaseOfSTLContainer<C>,
|
243
|
+
IsConvertibleToSTLContainer<C>> {};
|
244
|
+
|
245
|
+
} // namespace strings_internal
|
246
|
+
ABSL_NAMESPACE_END
|
247
|
+
} // namespace absl
|
248
|
+
#endif // ABSL_STRINGS_INTERNAL_STL_TYPE_TRAITS_H_
|