diff --git a/include/boost/container/detail/tree.hpp b/include/boost/container/detail/tree.hpp index d0d1bc8..c1c83cc 100644 --- a/include/boost/container/detail/tree.hpp +++ b/include/boost/container/detail/tree.hpp @@ -294,6 +294,36 @@ class RecyclingCloner intrusive_container &m_icont; }; +template +//where KeyValueCompare is tree_value_compare +struct key_node_compare + : private KeyValueCompare +{ + explicit key_node_compare(const KeyValueCompare &comp) + : KeyValueCompare(comp) + {} + + template + struct is_node + { + static const bool value = is_same::value; + }; + + template + typename enable_if_c::value, const typename KeyValueCompare::value_type &>::type + key_forward(const T &node) const + { return node.get_data(); } + + template + typename enable_if_c::value, const T &>::type + key_forward(const T &key) const + { return key; } + + template + bool operator()(const KeyType &key1, const KeyType2 &key2) const + { return KeyValueCompare::operator()(this->key_forward(key1), this->key_forward(key2)); } +}; + template @@ -301,7 +331,7 @@ class tree : protected container_detail::node_alloc_holder < A , typename container_detail::intrusive_tree_type - < A, tree_value_compare + < A, tree_value_compare //ValComp , tree_type_value>::type > { @@ -354,36 +384,7 @@ class tree private: - template - struct key_node_compare - : private KeyValueCompare - { - key_node_compare(const KeyValueCompare &comp) - : KeyValueCompare(comp) - {} - - template - struct is_node - { - static const bool value = is_same::value; - }; - - template - typename enable_if_c::value, const value_type &>::type - key_forward(const T &node) const - { return node.get_data(); } - - template - typename enable_if_c::value, const T &>::type - key_forward(const T &key) const - { return key; } - - template - bool operator()(const KeyType &key1, const KeyType2 &key2) const - { return KeyValueCompare::operator()(this->key_forward(key1), this->key_forward(key2)); } - }; - - typedef key_node_compare KeyNodeCompare; + typedef key_node_compare KeyNodeCompare; public: typedef container_detail::iterator iterator;