| I need to know how to complete it |
| My list constructor that takes a "count" as the parameter isn't being called |
| I saw that the standard library has overloads of the erase and insert functions that take a const_iterator and return an iterator |
Link<Elem> *curr you may create copy constructor/operator for each other. Normally const shouldn't be removed.
| What makes you think so? |
list<int> lst(6); and list<int> lst{6}; both just give me list of size one with a Link<int> that has a value of 6. It doesn't give me what I want which is a list of size 6 initialized to 0s. As you can see, I even marked that constructor with the keyword "explicit". But that also doesn't help. |
|
iterator insert( const_iterator pos, const T& value );iterator insert( const_iterator pos, T&& value );void insert( iterator pos, size_type count, const T& value );iterator insert( const_iterator pos, size_type count, const T& value ); |
|
|
|
iterator insert( const_iterator pos, std::initializer_list<T> ilist );iterator erase( iterator pos );(until C++11) iterator erase( const_iterator pos );(since C++11) (2) iterator erase( iterator first, iterator last );(until C++11) iterator erase( const_iterator first, const_iterator last );(since C++11) |
| Notice how the last two take a const_iterator as the first argument but return a normal iterator? |
| It doesn't give me what I want which is a list of size 6 initialized to 0s |
Elem. I suggest that you remove the constructor on line 172 and change the constructor on line 181 tolist(size_type count, const Elem &v);.| I even marked that constructor with the keyword "explicit". |
| Okay, so wouldn't it be good to make that constructor on line 181 take a default argument as its second parameter? |
Elem confuse the user of the class about what happens when you pass a single value.| Although, for that, first I need to know if a default parameter can be initialized to the default value of any type T directly in the parameter list. Is this possible? |
| And could help me with const_iterator erase and insert functions, too, please? |
|
|
list(size_type count, const Elem &v = {}); without the compiler giving an error?