Closed GoogleCodeExporter closed 9 years ago
0. Не собирается:
Geometry.cpp: In function ‘double distance(segment<T>)’:
Geometry.cpp:118: error: expected `)' before ‘s’
Geometry.cpp:118: error: expected `)' before ‘;’ token
Geometry.cpp: In copy constructor ‘polygon<T>::polygon(const polygon<T>&)’:
Geometry.cpp:186: error: expected type-specifier before ‘point’
Geometry.cpp:186: error: expected `;' before ‘point’
1. В polygon Вы поддерживаете внутри класса
массив, хранящийся в куче. Это ж как надо
себя не любить, чтобы такое делать :) Есть
ведь уже готовый класс vector<T>, который
решает все Ваши проблемы.
2. polygon() - конструктор по умолчанию создает
какой-то странный многоугольник с тремя
магическими точками:
point<T> P0(0,0), P1(1,0), P2(0,1);
3. Используя polygon, можно получить утечку
памяти: просто сделав копирование. У Вас
ведь не переопределен operator=. Между прочим,
если бы Вы использовали внутри vector<T>, этой
проблемы не было бы.
Решение не принято.
Original comment by aivyu...@gmail.com
on 19 May 2013 at 3:17
Original comment by zhilinskaya.valentina
on 19 May 2013 at 6:55
Не собирается:
Geometry.cpp: In function 'double distance(segment<T>)':
Geometry.cpp:119:75: error: expected ')' before 's'
Geometry.cpp:119:168: error: expected ')' before ';' token
Geometry.cpp: In instantiation of 'double length(point<T>, point<T>) [with T =
double]':
Geometry.cpp:95:3: required from 'bool segment<T>::HasPoint(const point<T>&)
const [with T = double]'
Geometry.cpp:212:6: required from 'bool polygon<T>::HasPoint(const point<T>&)
const [with T = double]'
Geometry.cpp:385:21: required from here
Geometry.cpp:55:109: error: 'sqrt' was not declared in this scope
Original comment by aivyu...@gmail.com
on 26 May 2013 at 12:31
Original comment by zhilinskaya.valentina
on 26 May 2013 at 3:37
Решение принято.
Оценка: 0.2 балла
Original comment by aivyu...@gmail.com
on 26 May 2013 at 7:47
Original issue reported on code.google.com by
zhilinskaya.valentina
on 18 May 2013 at 9:47