|
|
|
@ -27,12 +27,17 @@ |
|
|
|
|
#include <functional> |
|
|
|
|
#include <iterator> |
|
|
|
|
|
|
|
|
|
#if GRPC_USE_CPP_STD_LIB |
|
|
|
|
#include <map> |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#include "src/core/lib/gpr/useful.h" |
|
|
|
|
#include "src/core/lib/gprpp/memory.h" |
|
|
|
|
#include "src/core/lib/gprpp/pair.h" |
|
|
|
|
#include "src/core/lib/gprpp/ref_counted_ptr.h" |
|
|
|
|
|
|
|
|
|
namespace grpc_core { |
|
|
|
|
|
|
|
|
|
struct StringLess { |
|
|
|
|
bool operator()(const char* a, const char* b) const { |
|
|
|
|
return strcmp(a, b) < 0; |
|
|
|
@ -50,6 +55,13 @@ struct RefCountedPtrLess { |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#if GRPC_USE_CPP_STD_LIB |
|
|
|
|
|
|
|
|
|
template <class Key, class T, class Compare = std::less<Key>> |
|
|
|
|
using Map = std::map<Key, T, Compare>; |
|
|
|
|
|
|
|
|
|
#else // GRPC_USE_CPP_STD_LIB
|
|
|
|
|
|
|
|
|
|
namespace testing { |
|
|
|
|
class MapTest; |
|
|
|
|
} |
|
|
|
@ -537,5 +549,9 @@ int Map<Key, T, Compare>::CompareKeys(const key_type& lhs, |
|
|
|
|
} |
|
|
|
|
return left_comparison ? -1 : 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif // GRPC_USE_CPP_STD_LIB
|
|
|
|
|
|
|
|
|
|
} // namespace grpc_core
|
|
|
|
|
|
|
|
|
|
#endif /* GRPC_CORE_LIB_GPRPP_MAP_H */ |
|
|
|
|