Open GoogleCodeExporter opened 9 years ago
Я переименовал каталоги. Прежде чем
что-либо менять, сделайте svn update.
Original comment by aivyu...@gmail.com
on 6 Apr 2013 at 6:49
0. Код не собирается:
Vector.cpp:
Vector.cpp:215: error: invalid use of template-name ‘std::iterator’ without
an argument list
Vector.cpp:216: error: invalid use of template-name ‘std::iterator’ without
an argument list
Vector.cpp: In member function ‘int
TVector<T>::iter::operator-(TVector<T>::iter)’:
Vector.cpp:60: error: ‘t’ was not declared in this scope
Vector.cpp: In constructor ‘TVector<T>::TVector(T*, int)’:
Vector.cpp:74: error: declaration of ‘TVector<T> original_size’ shadows a
parameter
Vector.cpp: In member function ‘bool TVector<T>::empty()’:
Vector.cpp:90: error: ‘tsize’ was not declared in this scope
Vector.cpp: In member function ‘TVector<T>::iter TVector<T>::begin()’:
Vector.cpp:93: error: ‘begI’ was not declared in this scope
Vector.cpp: In member function ‘TVector<T>::iter TVector<T>::end()’:
Vector.cpp:96: error: ‘endI’ was not declared in this scope
Vector.cpp: In member function ‘T& TVector<T>::back()’:
Vector.cpp:117: error: there are no arguments to ‘ErrorWarn’ that depend on
a template parameter, so a declaration of ‘ErrorWarn’ must be available
Vector.cpp:117: error: (if you use ‘-fpermissive’, G++ will accept your
code, but allowing the use of an undeclared name is deprecated)
Vector.cpp: In member function ‘T& TVector<T>::front()’:
Vector.cpp:122: error: there are no arguments to ‘ErrorWarn’ that depend on
a template parameter, so a declaration of ‘ErrorWarn’ must be available
Vector.cpp: In member function ‘void TVector<T>::swap(unsigned int, unsigned
int)’:
Vector.cpp:130: error: there are no arguments to ‘ErrorWarn’ that depend on
a template parameter, so a declaration of ‘ErrorWarn’ must be available
Vector.cpp: In member function ‘void TVector<T>::erase(TVector<T>::iter)’:
Vector.cpp:182: error: ‘i’ was not declared in this scope
Vector.cpp: In member function ‘bool TVector<T>::operator=(TVector<T>)’:
Vector.cpp:200: error: expected `;' before ‘for’
Vector.cpp:200: error: ‘i’ was not declared in this scope
Vector.cpp:200: error: expected `;' before ‘)’ token
Vector.cpp: In member function ‘void TVector<T>::setup()’:
Vector.cpp:242: error: ‘begI’ was not declared in this scope
Vector.cpp:242: error: missing template arguments before ‘(’ token
Vector.cpp:243: error: ‘endI’ was not declared in this scope
Vector.cpp:243: error: missing template arguments before ‘(’ token
List.cpp:
List.cpp: In member function ‘TIter<T> TIter<T>::operator--(int)’:
List.cpp:49: error: ‘TIterator’ was not declared in this scope
List.cpp:49: error: expected `;' before ‘it’
List.cpp:51: error: ‘it’ was not declared in this scope
List.cpp: In constructor ‘TList<T>::TList(TNode<T>*, TNode<T>*)’:
List.cpp:88: error: ‘l’ was not declared in this scope
List.cpp:89: error: ‘r’ was not declared in this scope
List.cpp: In copy constructor ‘TList<T>::TList(const TList<T>&)’:
List.cpp:93: error: missing template arguments before ‘*’ token
List.cpp:93: error: ‘pre’ was not declared in this scope
List.cpp:93: error: expected type-specifier before ‘TNode’
List.cpp:93: error: expected `;' before ‘TNode’
List.cpp:95: error: missing template arguments before ‘*’ token
List.cpp:95: error: ‘cur’ was not declared in this scope
List.cpp:96: error: ‘prev’ was not declared in this scope
List.cpp:97: error: missing template arguments before ‘*’ token
List.cpp:97: error: ‘newn’ was not declared in this scope
List.cpp:97: error: expected type-specifier before ‘TNode’
List.cpp:97: error: expected `;' before ‘TNode’
List.cpp: In member function ‘void TList<T>::clear()’:
List.cpp:118: error: missing template arguments before ‘*’ token
List.cpp:118: error: ‘cur’ was not declared in this scope
List.cpp: In member function ‘TNode<T>* TList<T>::push_front(int)’:
List.cpp:142: error: missing template arguments before ‘*’ token
List.cpp:142: error: ‘p’ was not declared in this scope
List.cpp: In member function ‘TNode<T>* TList<T>::push_back(int)’:
List.cpp:150: error: missing template arguments before ‘*’ token
List.cpp:150: error: ‘p’ was not declared in this scope
List.cpp:150: error: expected type-specifier before ‘TNode’
List.cpp:150: error: expected `;' before ‘TNode’
List.cpp:151: error: there are no arguments to ‘Pushback’ that depend on a
template parameter, so a declaration of ‘Pushback’ must be available
List.cpp:151: error: (if you use ‘-fpermissive’, G++ will accept your code,
but allowing the use of an undeclared name is deprecated)
List.cpp: In member function ‘TNode<T>* TList<T>::insert(TNode<T>*, int)’:
List.cpp:177: error: missing template arguments before ‘*’ token
List.cpp:177: error: ‘p’ was not declared in this scope
List.cpp:177: error: expected type-specifier before ‘TNode’
List.cpp:177: error: expected `;' before ‘TNode’
List.cpp: In member function ‘void TList<T>::splice(TIter<T>, TList<T>&,
TIter<T>, TIter<T>)’:
List.cpp:220: error: expected initializer before ‘!=’ token
List.cpp:220: error: expected `;' before ‘)’ token
List.cpp: In member function ‘void TList<T>::erase(TIter<T>)’:
List.cpp:224: error: ‘n’ was not declared in this scope
1. Нет тестов. В т.ч. нет тестов на утечки
памяти.
2. Зачем std::vector делать другом Вашего класса
TVector?
3. У итераторов нет оператор пост-
инкремента/декремента.
4. Нет константных итераторов.
5. Конструктор копирования не
переопределен, поэтому простой код вызовет
утечки памяти:
vector<int> a;
...
vector<int> b(a);
Объясните почему.
6. Методы size(), empty(), capacity(), ... нельзя вызвать у
константного вектора.
Решение очень сырое.
Original comment by aivyu...@gmail.com
on 6 Apr 2013 at 6:55
Redone.
5. Пофиксил, если не делать, утечки
происходят из-за неудаления потом этой
памяти
Original comment by ae.insomniac
on 26 May 2013 at 9:55
0. Warnings:
Vector.cpp: In instantiation of 'void TVector<T>::reserve(size_t) [with T =
int; size_t = long unsigned int]':
Vector.cpp:76:4: required from 'void TVector<T>::push_back(const T&) [with T
= int]'
Vector.cpp:155:16: required from here
Vector.cpp:59:15: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
Vector.cpp: In member function 'const T& TVector<T>::operator[](size_t) const
[with T = int; size_t = long unsigned int]':
Vector.cpp:117:2: warning: control reaches end of non-void function
[-Wreturn-type]
Между прочим, последний варнинг указывает
на грубую ошибку, приводящую как правило к
проезду по памяти и аварийному завершению.
1. Its2amAndImJustSittingHereTesturbating - оставьте,
пожалуйста, свои грязные шуточки при себе.
2. Тесты на утечки памяти так и не появились.
3. В swap ошибка.
Original comment by aivyu...@gmail.com
on 26 May 2013 at 10:03
0. Заделано.
1. Это был референс. Изменено на более
соответствующий
2. Они есть второй функцией (вектор) и в
конце основного тестинга (список)
3. Переписан
Original comment by ae.insomniac
on 27 May 2013 at 1:09
Не собираются оба файла:
List.cpp:263: error: too few template-parameter-lists
List.cpp:264: error: too few template-parameter-lists
List.cpp: In function ‘void MoreTestingRequired()’:
List.cpp:330: error: ‘template<class T> struct TNode’ used without template
parameters
List.cpp:330: error: ‘template<class T> struct TNode’ used without template
parameters
Vector.cpp: In function ‘void TestDriveUnlimited()’:
Vector.cpp:228: error: no matching function for call to ‘A::A(A)’
Vector.cpp:11: note: candidates are: A::A(A&)
Original comment by aivyu...@gmail.com
on 27 May 2013 at 7:41
Original comment by ae.insomniac
on 27 May 2013 at 9:41
Все еще не собирается List.cpp:
List.cpp:291: error: too few template-parameter-lists
Вектор принят. Оценка: 0.8 балла.
Жду список.
Original comment by aivyu...@gmail.com
on 27 May 2013 at 10:21
Redone List
Original comment by ae.insomniac
on 27 May 2013 at 10:49
Original issue reported on code.google.com by
ae.insomniac
on 13 Mar 2013 at 4:39