map is bst
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
#define BST_TEMPLATE template < typename Key, typename T, typename Compare, typename Allocator >
|
||||
#define BST Bst<Key, T, Compare, Allocator>
|
||||
#define BST map<Key, T, Compare, Allocator>
|
||||
|
||||
namespace ft {
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace ft {
|
||||
|
||||
BST_TEMPLATE
|
||||
BST::
|
||||
Bst(const Compare& comp, const Allocator& alloc) :
|
||||
map(const Compare& comp, const Allocator& alloc) :
|
||||
_size(0),
|
||||
_root(NULL),
|
||||
_comp(comp),
|
||||
@@ -22,7 +22,7 @@ _allocator(alloc)
|
||||
BST_TEMPLATE
|
||||
template < typename InputIt >
|
||||
BST::
|
||||
Bst(InputIt first, InputIt last, const Compare& comp, const Allocator& alloc) :
|
||||
map(InputIt first, InputIt last, const Compare& comp, const Allocator& alloc) :
|
||||
_size(0),
|
||||
_root(NULL),
|
||||
_comp(comp),
|
||||
@@ -34,7 +34,7 @@ _allocator(alloc)
|
||||
|
||||
BST_TEMPLATE
|
||||
BST::
|
||||
Bst(const Bst& src) :
|
||||
map(const map& src) :
|
||||
_size(0),
|
||||
_root(NULL),
|
||||
_comp(src._comp),
|
||||
@@ -46,7 +46,7 @@ _allocator(src._allocator)
|
||||
|
||||
BST_TEMPLATE
|
||||
BST::
|
||||
~Bst()
|
||||
~map()
|
||||
{
|
||||
clear();
|
||||
_allocator_node_sentinel.destroy(_sentinel);
|
||||
@@ -55,11 +55,11 @@ BST::
|
||||
|
||||
BST_TEMPLATE
|
||||
BST& BST::
|
||||
operator=(const Bst& rhs)
|
||||
operator=(const map& rhs)
|
||||
{
|
||||
if (this == &rhs)
|
||||
return (*this);
|
||||
Bst new_bst(rhs.begin(), rhs.end());
|
||||
map new_bst(rhs.begin(), rhs.end());
|
||||
swap(new_bst);
|
||||
return (*this);
|
||||
}
|
||||
@@ -241,7 +241,7 @@ typename BST::size_type BST::
|
||||
|
||||
BST_TEMPLATE
|
||||
void BST::
|
||||
swap(Bst& other)
|
||||
swap(map& other)
|
||||
{
|
||||
node<value_type>* tmp_root = _root;
|
||||
node_sentinel<value_type>* tmp_sentinel = _sentinel;
|
||||
|
||||
Reference in New Issue
Block a user