Skip to main content
added 133 characters in body
Source Link
user228914
user228914

The InsertAt and RemoveAt operations are quite expensive when implemented to accept a position. These operations are usually implemented using iterators, which are wrappers around the internal node structure.

Making the stream output operator part of the class is rather inflexible. You should define a standalone non-friend function to help you dump your list. To do that non-friendliness, however, you need access to the internal node structure. But this problem fades away if you implement the iterators.

Generally you might want to comply with standard containers concept. Use same method names (ie. size(), push_back()), etc.

Also I'm not sure but maybe a standard std::swap is going to be enough and actually more efficient. Definitely the return on the end of void function is useless.

  1. The InsertAt() and RemoveAt() operations are quite expensive when implemented to accept a position. These operations are usually implemented using iterators, which are wrappers around the internal node structure.

  2. Making the stream output operator part of the class is rather inflexible. You should define a standalone non-friend function to help you dump your list. To do that non-friendliness, however, you need access to the internal node structure. But this problem fades away if you implement the iterators.

  3. Generally, you might want to comply with the concept of the standard containers. Use the same method names (ie. size(), push_back()), etc.

  4. Also, I'm not sure but maybe a standard std::swap is going to be enough and actually more efficient. Definitely, the return on the end of void function is useless.

The InsertAt and RemoveAt operations are quite expensive when implemented to accept a position. These operations are usually implemented using iterators, which are wrappers around the internal node structure.

Making the stream output operator part of the class is rather inflexible. You should define a standalone non-friend function to help you dump your list. To do that non-friendliness, however, you need access to the internal node structure. But this problem fades away if you implement the iterators.

Generally you might want to comply with standard containers concept. Use same method names (ie. size(), push_back()), etc.

Also I'm not sure but maybe a standard std::swap is going to be enough and actually more efficient. Definitely the return on the end of void function is useless.

  1. The InsertAt() and RemoveAt() operations are quite expensive when implemented to accept a position. These operations are usually implemented using iterators, which are wrappers around the internal node structure.

  2. Making the stream output operator part of the class is rather inflexible. You should define a standalone non-friend function to help you dump your list. To do that non-friendliness, however, you need access to the internal node structure. But this problem fades away if you implement the iterators.

  3. Generally, you might want to comply with the concept of the standard containers. Use the same method names (ie. size(), push_back()), etc.

  4. Also, I'm not sure but maybe a standard std::swap is going to be enough and actually more efficient. Definitely, the return on the end of void function is useless.

added 165 characters in body
Source Link
slepic
  • 5.7k
  • 2
  • 10
  • 27

The InsertAt and RemoveAt operations are quite expensive when implemented to accept a position. These operations are usually implemented using iterators, which are wrappers around the internal node structure.

Making the stream output operator part of the class is rather inflexible. You should define a standalone non-friend function to help you dump your list. To do that non-friendliness, however, you need access to the internal node structure. But this problem fades away if you implement the iterators.

Generally you might want to comply with standard containers concept. Use same method names (ie. size(), push_back()), etc.

Also I'm not sure but maybe a standard std::swap is going to be enough and actually more efficient. Definitely the return on the end of void function is useless.

The InsertAt and RemoveAt operations are quite expensive when implemented to accept a position. These operations are usually implemented using iterators, which are wrappers around the internal node structure.

Making the stream output operator part of the class is rather inflexible. You should define a standalone non-friend function to help you dump your list. To do that non-friendliness, however, you need access to the internal node structure. But this problem fades away if you implement the iterators.

Generally you might want to comply with standard containers concept. Use same method names (ie. size(), push_back()), etc.

The InsertAt and RemoveAt operations are quite expensive when implemented to accept a position. These operations are usually implemented using iterators, which are wrappers around the internal node structure.

Making the stream output operator part of the class is rather inflexible. You should define a standalone non-friend function to help you dump your list. To do that non-friendliness, however, you need access to the internal node structure. But this problem fades away if you implement the iterators.

Generally you might want to comply with standard containers concept. Use same method names (ie. size(), push_back()), etc.

Also I'm not sure but maybe a standard std::swap is going to be enough and actually more efficient. Definitely the return on the end of void function is useless.

Source Link
slepic
  • 5.7k
  • 2
  • 10
  • 27

The InsertAt and RemoveAt operations are quite expensive when implemented to accept a position. These operations are usually implemented using iterators, which are wrappers around the internal node structure.

Making the stream output operator part of the class is rather inflexible. You should define a standalone non-friend function to help you dump your list. To do that non-friendliness, however, you need access to the internal node structure. But this problem fades away if you implement the iterators.

Generally you might want to comply with standard containers concept. Use same method names (ie. size(), push_back()), etc.