divyang4481 / mipt-hw

Automatically exported from code.google.com/p/mipt-hw
0 stars 0 forks source link

task01_TList (Анастасьев) #188

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
anastasyev_daniil/task01_list/

Original issue reported on code.google.com by dan.anas...@gmail.com on 11 Mar 2013 at 12:17

GoogleCodeExporter commented 9 years ago
Compilation errors:
main.cpp:318: error: too few template-parameter-lists
main.cpp:319: error: too few template-parameter-lists

Решение не принято. 

Original comment by aivyu...@gmail.com on 6 Apr 2013 at 6:47

GoogleCodeExporter commented 9 years ago

Original comment by dan.anas...@gmail.com on 24 May 2013 at 9:10

GoogleCodeExporter commented 9 years ago
1. Метод iterator::nd() раскрывает внутреннюю 
реализацию Вашего класса. Это плохая идея, 
т.к. пользователь может вызвать в своем 
коде этот метод и Вы уже не сможете менять 
внутреннее устройство класса (ну или по 
крайней мере будете в этом сильно 
ограничены).

2. Невозможно создать копию от констатного 
списка:
const TList<int> a(10);
TList<int> b(a);

3. Добавляю в main() следующий код:
        {
            typedef TList< TFoo<int> > TListFoo;

            TListFoo a;
            for (int i = 0; i < 10; ++i)
                a.Push_back(i);

            TListFoo b = a;
            for (int i = 0; i < 10; ++i)
                a.Push_front(i);

            a.Swap(b);

            TListFoo c = a;
            b = c;
        }
Запускаю:
...
TFoo::Created = 221
TFoo::Deleted = 220

Так что, есть утечки.

Решение не принято.

Original comment by aivyu...@gmail.com on 26 May 2013 at 11:22

GoogleCodeExporter commented 9 years ago

Original comment by dan.anas...@gmail.com on 26 May 2013 at 3:05

GoogleCodeExporter commented 9 years ago
Теперь не собирается:
main.cpp: In member function 'void TList<T>::Splice(TList<T>::iterator, 
TList<T>&, TList<T>::iterator, TList<T>::iterator)':
main.cpp:425:3: error: 'it' was not declared in this scope
main.cpp: In function 'void Print(TList<T>&)':
main.cpp:500:2: error: need 'typename' before 'TList<T>::iterator' because 
'TList<T>' is a dependent scope
main.cpp:500:22: error: expected ';' before 'it'
main.cpp:501:12: error: 'it' was not declared in this scope
main.cpp: In instantiation of 'void Print(TList<T>&) [with T = TFoo<int>]':
main.cpp:511:10:   required from here
main.cpp:500:2: error: dependent-name 'TList<T>::iterator' is parsed as a 
non-type, but instantiation yields a type
main.cpp:500:2: note: say 'typename TList<T>::iterator' if a type is meant

Original comment by aivyu...@gmail.com on 26 May 2013 at 3:06

GoogleCodeExporter commented 9 years ago
не ту версию исправлял...

Original comment by dan.anas...@gmail.com on 26 May 2013 at 3:16

GoogleCodeExporter commented 9 years ago
Решение принято.

Original comment by aivyu...@gmail.com on 26 May 2013 at 3:17