remove #include <functional> from phmap_fwd_decl.h

This commit is contained in:
greg
2020-01-03 14:19:55 -05:00
parent c0a33e39cd
commit 942403f0db
3 changed files with 27 additions and 6 deletions
+13 -1
View File
@@ -755,6 +755,7 @@ namespace container_internal {
StringBtreeDefaultLess(std::less<std::string>) {} // NOLINT
#if PHMAP_HAVE_STD_STRING_VIEW
StringBtreeDefaultLess(std::less<std::string_view>) {} // NOLINT
StringBtreeDefaultLess(phmap::Less<std::string_view>) {} // NOLINT
phmap::weak_ordering operator()(std::string_view lhs,
std::string_view rhs) const {
@@ -810,6 +811,11 @@ namespace container_internal {
using type = StringBtreeDefaultLess;
};
template <>
struct key_compare_to_adapter<phmap::Less<std::string>> {
using type = StringBtreeDefaultLess;
};
template <>
struct key_compare_to_adapter<std::greater<std::string>> {
using type = StringBtreeDefaultGreater;
@@ -821,6 +827,11 @@ namespace container_internal {
using type = StringBtreeDefaultLess;
};
template <>
struct key_compare_to_adapter<phmap::Less<std::string_view>> {
using type = StringBtreeDefaultLess;
};
template <>
struct key_compare_to_adapter<std::greater<std::string_view>> {
using type = StringBtreeDefaultGreater;
@@ -1071,7 +1082,8 @@ namespace container_internal {
using use_linear_search = std::integral_constant<
bool,
std::is_arithmetic<key_type>::value &&
(std::is_same<std::less<key_type>, key_compare>::value ||
(std::is_same<phmap::Less<key_type>, key_compare>::value ||
std::is_same<std::less<key_type>, key_compare>::value ||
std::is_same<std::greater<key_type>, key_compare>::value)>;
+9
View File
@@ -80,6 +80,15 @@ struct EqualTo
}
};
template <class T>
struct Less
{
inline bool operator()(const T& a, const T& b) const
{
return std::less<T>()(a, b);
}
};
namespace type_traits_internal {
template <typename... Ts>
+5 -5
View File
@@ -20,7 +20,6 @@
#include <memory>
#include <utility>
#include <functional>
#if defined(PHMAP_USE_ABSL_HASH)
namespace absl { template <class T> struct Hash; };
@@ -35,6 +34,7 @@ namespace phmap {
#endif
template <class T> struct EqualTo;
template <class T> struct Less;
template <class T> using Allocator = typename std::allocator<T>;
template<class T1, class T2> using Pair = typename std::pair<T1, T2>;
@@ -128,19 +128,19 @@ namespace phmap {
class parallel_node_hash_map;
// ------------- forward declarations for btree containers ----------------------------------
template <typename Key, typename Compare = std::less<Key>,
template <typename Key, typename Compare = phmap::Less<Key>,
typename Alloc = phmap::Allocator<Key>>
class btree_set;
template <typename Key, typename Compare = std::less<Key>,
template <typename Key, typename Compare = phmap::Less<Key>,
typename Alloc = phmap::Allocator<Key>>
class btree_multiset;
template <typename Key, typename Value, typename Compare = std::less<Key>,
template <typename Key, typename Value, typename Compare = phmap::Less<Key>,
typename Alloc = phmap::Allocator<phmap::container_internal::Pair<const Key, Value>>>
class btree_map;
template <typename Key, typename Value, typename Compare = std::less<Key>,
template <typename Key, typename Value, typename Compare = phmap::Less<Key>,
typename Alloc = phmap::Allocator<phmap::container_internal::Pair<const Key, Value>>>
class btree_multimap;