Skip to content

Commit 750c261

Browse files
authored
Update list.h
1 parent 5aa72fd commit 750c261

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stl-cp/list.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ class list
7575
//-------------- constructor & copy operator ----------
7676

7777
// copy constructor
78-
list(list<T>& a) :
78+
list(const list<T>& a ) :
7979
mHeader( new node() ), mSize( 0 ) {
80-
for (iterator it = a.begin();it != a.end();it++) {
81-
push_back(*it);
80+
for (auto &x : *this) {
81+
push_back(x);
8282
}
8383
}
84-
84+
8585
// default constructor
8686
list() :
8787
mHeader( new node() ), mSize( 0 ) { }

0 commit comments

Comments
 (0)