Opened 3 years ago

Closed 3 years ago

#668 closed ожидается проверка (задача сдана)

WW #13 (Ushakov)

Reported by: ushakov.vladislav Owned by: Святослав Власов
Component: WW_array Version: 1.0
Keywords: Cc:

Description


Change History (3)

comment:1 Changed 3 years ago by Святослав Власов

Type: ожидается проверкаожидаются исправления

Не собралось

src/main.cpp: In instantiation of ‘void test_write_read() [with T = int; long unsigned int N = 50]’:
src/main.cpp:226:30:   required from here
src/main.cpp:88:13: error: assignment of read-only location ‘a.lab_13::my_array<int, 50>::at(i)’
   88 |     a.at(i) = get_object<T>(i);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~
src/main.cpp: In instantiation of ‘void test_write_read() [with T = IntWrapper; long unsigned int N = 50]’:
src/main.cpp:227:37:   required from here
src/main.cpp:88:13: error: passing ‘const IntWrapper’ as ‘this’ argument discards qualifiers [-fpermissive]
src/main.cpp:59:8: note:   in call to ‘IntWrapper& IntWrapper::operator=(IntWrapper&&)’
   59 | struct IntWrapper {
      |        ^~~~~~~~~~
src/main.cpp: In instantiation of ‘void test_write_change_read() [with T = int; long unsigned int N = 50]’:
src/main.cpp:229:37:   required from here
src/main.cpp:110:5: error: increment of read-only location ‘a.lab_13::my_array<int, 50>::at(i)’
  110 |     ++a.at(i);
      |     ^~~~~~~~~
src/main.cpp: In instantiation of ‘void test_write_change_read() [with T = IntWrapper; long unsigned int N = 50]’:
src/main.cpp:230:44:   required from here
src/main.cpp:110:5: error: passing ‘const IntWrapper’ as ‘this’ argument discards qualifiers [-fpermissive]
src/main.cpp:62:15: note:   in call to ‘IntWrapper& IntWrapper::operator++()’
   62 |   IntWrapper& operator++() {
      |               ^~~~~~~~
src/main.cpp: In instantiation of ‘void test_write_read() [with T = bool; long unsigned int N = 50]’:
src/main.cpp:250:31:   required from here
src/main.cpp:88:9: error: lvalue required as left operand of assignment
   88 |     a.at(i) = get_object<T>(i);
      |     ~~~~^~~
make: *** [Makefile:16: obj/main.o] Error 1

comment:2 Changed 3 years ago by ushakov.vladislav

Type: ожидаются исправленияожидается проверка

Ладно, наверное условие "Ведет себя так же, как operator[]" действительно подразумевает наличие обеих const/не const версий. Но почему-то сходу это было неочевидно :/

comment:3 Changed 3 years ago by Святослав Власов

Resolution: задача сдана
Status: assignedclosed

Ты слишком перемудрил. У тебя в деструкторе происходит двойной вызов деструктора для объектов массива. Сначала ты делаешь это руками, а потом компилятор делает это при уничтожении массива, т.к. он статический.
Тесты на булев массив тоже попадали. Как минимум, сгенерированный компилятором оператор присваивания для BitReference? работает неправильно. Но может быть есть еще ошибки в битовых операциях.

6/10

Note: See TracTickets for help on using tickets.