| 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 | |
| 49 // Use C++11 unordered_{map|set} if available. | 44 // Use C++11 unordered_{map|set} if available. |
| 50 #elif ((_LIBCPP_STD_VER >= 11) || \ | 45 #if ((_LIBCPP_STD_VER >= 11) || \ |
| 51 (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \ | 46 (((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \ |
| 52 (__GLIBCXX__ > 20090421))) | 47 (__GLIBCXX__ > 20090421))) |
| 53 # define GOOGLE_PROTOBUF_HAS_CXX11_HASH | 48 # define GOOGLE_PROTOBUF_HAS_CXX11_HASH |
| 54 | 49 |
| 55 // For XCode >= 4.6: the compiler is clang with libc++. | 50 // For XCode >= 4.6: the compiler is clang with libc++. |
| 56 // For earlier XCode version: the compiler is gcc-4.2.1 with libstdc++. | 51 // For earlier XCode version: the compiler is gcc-4.2.1 with libstdc++. |
| 57 // libc++ provides <unordered_map> and friends even in non C++11 mode, | 52 // libc++ provides <unordered_map> and friends even in non C++11 mode, |
| 58 // and it does not provide the tr1 library. Therefore the following macro | 53 // and it does not provide the tr1 library. Therefore the following macro |
| 59 // checks against this special case. | 54 // checks against this special case. |
| 60 // Note that we should not test the __APPLE_CC__ version number or the | 55 // Note that we should not test the __APPLE_CC__ version number or the |
| 61 // __clang__ macro, since the new compiler can still use -stdlib=libstdc++, in | 56 // __clang__ macro, since the new compiler can still use -stdlib=libstdc++, in |
| 62 // which case <unordered_map> is not compilable without -std=c++11 | 57 // which case <unordered_map> is not compilable without -std=c++11 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 struct streq { | 424 struct streq { |
| 430 inline bool operator()(const char* a, const char* b) const { | 425 inline bool operator()(const char* a, const char* b) const { |
| 431 return strcmp(a, b) == 0; | 426 return strcmp(a, b) == 0; |
| 432 } | 427 } |
| 433 }; | 428 }; |
| 434 | 429 |
| 435 } // namespace protobuf | 430 } // namespace protobuf |
| 436 } // namespace google | 431 } // namespace google |
| 437 | 432 |
| 438 #endif // GOOGLE_PROTOBUF_STUBS_HASH_H__ | 433 #endif // GOOGLE_PROTOBUF_STUBS_HASH_H__ |
| OLD | NEW |