Skip to content

Commit 1fd42c0

Browse files
committed
cpp08/ex02 wip
1 parent eb3df8f commit 1fd42c0

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

cpp08/ex02/include/MutantStack.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MutantStack : public std::stack<T, C>
1313
operator= (const MutantStack<T, C> &rhs)
1414
{
1515
if (this != &rhs)
16-
this->c.operator= (rhs);
16+
this->c.operator= (rhs.c);
1717
return (*this);
1818
};
1919
~MutantStack<T, C> (){};

cpp08/ex02/src/main.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,21 @@ main (void)
5959
ite3 = mstack3.end ();
6060
for (; it3 != ite3; ++it3)
6161
print (*it3);
62+
63+
print (SUB_TITTLE YELLOW "Copy construcor" RESET);
64+
MutantStack<float, std::list<float> > copy (mstack3);
65+
MutantStack<float, std::list<float> >::iterator it4, ite4;
66+
it4 = copy.begin ();
67+
ite4 = copy.end ();
68+
for (; it4 != ite4; ++it4)
69+
print (*it4);
70+
71+
print (SUB_TITTLE YELLOW "Assignment operator" RESET);
72+
MutantStack<float, std::list<float> > assign;
73+
assign = mstack3;
74+
MutantStack<float, std::list<float> >::iterator it5, ite5;
75+
it5 = assign.begin ();
76+
ite5 = assign.end ();
77+
for (; it5 != ite5; ++it5)
78+
print (*it5);
6279
}

0 commit comments

Comments
 (0)