Programming Conversations Lecture 13 part 1

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Some errors in the implementation/lecture :

1) Should it not be T data[k] rather than T[k] data ?
2) C style arrays cannot be copied directly by the assignment operator, however, they get copied when they are part of a struct and the struct is copied. Therefore, the copy constructor body should read { *this = x; } you cannot use member initialization syntax for the data member as shown

VivekNa
Автор

Pedantic nitpick: around 41:30 a student asks if you can have an array with zero elements. The answer is NO. Creating a zero-length array is forbidden and leads to undefined behavior.

Jeremygee
Автор

implementing max_size in terms of size looks weird, perhaps it should be the other way around

or maybe max_size does not really make sense for this kind of "container" and should be left out

vlastami