File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1616#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_HTTP_HEADER_H
1717
1818#include " google/cloud/version.h"
19+ #if defined(_WIN64) || defined(__LP64__) || defined(__x86_64__) || \
20+ defined (__ppc64__)
1921#include " absl/container/flat_hash_map.h"
22+ #else
23+ #include < unordered_map>
24+ #endif
2025#include " absl/strings/ascii.h"
2126#include < string>
2227#include < vector>
@@ -153,7 +158,35 @@ class HttpHeader {
153158 std::vector<std::string> values_;
154159};
155160
161+ // Abseil does not guarantee compatibility with 32-bit targets.
162+ #if defined(_WIN64) || defined(__LP64__) || defined(__x86_64__) || \
163+ defined (__ppc64__)
164+ // 64-bit architecture
156165using HttpHeaders = absl::flat_hash_map<HttpHeaderName, HttpHeader>;
166+ #else
167+ // 32-bit architecture
168+
169+ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
170+ } // namespace rest_internal
171+ } // namespace cloud
172+ } // namespace google
173+
174+ // This specialization has to be in the global namespace.
175+ template <>
176+ struct std ::hash<google::cloud::rest_internal::HttpHeaderName> {
177+ std::size_t operator ()(
178+ google::cloud::rest_internal::HttpHeaderName const & k) const noexcept {
179+ return std::hash<std::string>()(k.name ());
180+ }
181+ };
182+
183+ namespace google {
184+ namespace cloud {
185+ namespace rest_internal {
186+ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
187+
188+ using HttpHeaders = std::unordered_map<HttpHeaderName, HttpHeader>;
189+ #endif
157190
158191GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
159192} // namespace rest_internal
You can’t perform that action at this time.
0 commit comments