OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 #ifndef GOOGLE_PROTOBUF_STUBS_HASH_H__ | 35 #ifndef GOOGLE_PROTOBUF_STUBS_HASH_H__ |
36 #define GOOGLE_PROTOBUF_STUBS_HASH_H__ | 36 #define GOOGLE_PROTOBUF_STUBS_HASH_H__ |
37 | 37 |
38 #include <string.h> | 38 #include <string.h> |
39 #include <google/protobuf/stubs/common.h> | 39 #include <google/protobuf/stubs/common.h> |
40 | 40 |
41 #define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1 | 41 #define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1 |
42 #define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 | 42 #define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 |
43 | 43 |
| 44 // Android |
| 45 #if defined(__ANDROID__) |
| 46 # undef GOOGLE_PROTOBUF_HAVE_HASH_MAP |
| 47 # undef GOOGLE_PROTOBUF_HAVE_HASH_MAP |
| 48 |
44 // Use C++11 unordered_{map|set} if available. | 49 // Use C++11 unordered_{map|set} if available. |
45 #if ((_LIBCPP_STD_VER >= 11) || \ | 50 #elif ((_LIBCPP_STD_VER >= 11) || \ |
46 (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \ | 51 (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \ |
47 (__GLIBCXX__ > 20090421))) | 52 (__GLIBCXX__ > 20090421))) |
48 # define GOOGLE_PROTOBUF_HAS_CXX11_HASH | 53 # define GOOGLE_PROTOBUF_HAS_CXX11_HASH |
49 | 54 |
50 // For XCode >= 4.6: the compiler is clang with libc++. | 55 // For XCode >= 4.6: the compiler is clang with libc++. |
51 // For earlier XCode version: the compiler is gcc-4.2.1 with libstdc++. | 56 // For earlier XCode version: the compiler is gcc-4.2.1 with libstdc++. |
52 // libc++ provides <unordered_map> and friends even in non C++11 mode, | 57 // libc++ provides <unordered_map> and friends even in non C++11 mode, |
53 // and it does not provide the tr1 library. Therefore the following macro | 58 // and it does not provide the tr1 library. Therefore the following macro |
54 // checks against this special case. | 59 // checks against this special case. |
55 // Note that we should not test the __APPLE_CC__ version number or the | 60 // Note that we should not test the __APPLE_CC__ version number or the |
56 // __clang__ macro, since the new compiler can still use -stdlib=libstdc++, in | 61 // __clang__ macro, since the new compiler can still use -stdlib=libstdc++, in |
57 // which case <unordered_map> is not compilable without -std=c++11 | 62 // which case <unordered_map> is not compilable without -std=c++11 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 struct streq { | 429 struct streq { |
425 inline bool operator()(const char* a, const char* b) const { | 430 inline bool operator()(const char* a, const char* b) const { |
426 return strcmp(a, b) == 0; | 431 return strcmp(a, b) == 0; |
427 } | 432 } |
428 }; | 433 }; |
429 | 434 |
430 } // namespace protobuf | 435 } // namespace protobuf |
431 } // namespace google | 436 } // namespace google |
432 | 437 |
433 #endif // GOOGLE_PROTOBUF_STUBS_HASH_H__ | 438 #endif // GOOGLE_PROTOBUF_STUBS_HASH_H__ |
OLD | NEW |