ID 5785666
Пользователь Псарев Александр Павлович
Время 16:32<< 16.11.2021 16:33 (27 д. 14:33) 16:33>>
Обработка 16:33 ... 16:33 (1,87 сек.)
Файл 5785666.cpp (CLang++ 5.0.0 + Address Sanitizer)
Турнир 2 курс. Программирование на C++. Турнир 2, осень 2021
Задача C: Smart Pointer
Набор тестов
Ограничения Время: 25с Память: 512Мб
Состояние  [?]
CE Ошибка компиляции
код | результаты
In file included from main.cpp:2:0:
SmartPointer.hpp:80:2: error: expected ';' after class definition
 }
  ^
  ;
SmartPointer.hpp: In constructor 'smart_pointer::SmartPointer<T, Allocator>::SmartPointer(smart_pointer::SmartPointer<T, Allocator>::value_type*)':
SmartPointer.hpp:25:18: error: expected type-specifier before 'Core'
 this->core = new Core();
                  ^~~~
SmartPointer.hpp:25:18: error: expected ';' before 'Core'
SmartPointer.hpp: In member function 'smart_pointer::SmartPointer<T, Allocator>& smart_pointer::SmartPointer<T, Allocator>::operator=(smart_pointer::SmartPointer<T, Allocator>::value_type*)':
SmartPointer.hpp:72:18: error: expected type-specifier before 'Core'
 this->core = new Core();
                  ^~~~
SmartPointer.hpp:72:18: error: expected ';' before 'Core'
SmartPointer.hpp: At global scope:
SmartPointer.hpp:81:14: error: expected class-name before '(' token
 ~SmartPointer() {
              ^
SmartPointer.hpp:89:1: error: 'value_type' does not name a type
 value_type &operator*() {
 ^~~~~~~~~~
SmartPointer.hpp:96:7: error: 'value_type' does not name a type
 const value_type &operator*() const {
       ^~~~~~~~~~
SmartPointer.hpp:103:1: error: 'value_type' does not name a type
 value_type *operator->() const {
 ^~~~~~~~~~
SmartPointer.hpp:110:1: error: 'value_type' does not name a type
 value_type *get() const {
 ^~~~~~~~~~
SmartPointer.hpp:117:17: error: non-member function 'smart_pointer::operator bool()' cannot have cv-qualifier
 operator bool() const {
                 ^~~~~
SmartPointer.hpp:117:17: error: 'smart_pointer::operator bool()' must be a nonstatic member function
SmartPointer.hpp:125:64: error: non-member function 'bool smart_pointer::operator==(const smart_pointer::SmartPointer<U, AnotherAllocator>&)' cannot have cv-qualifier
 bool operator==(const SmartPointer<U, AnotherAllocator> & ptr) const {
                                                                ^~~~~
SmartPointer.hpp:125:64: error: 'bool smart_pointer::operator==(const smart_pointer::SmartPointer<U, AnotherAllocator>&)' must take exactly two arguments
SmartPointer.hpp:129:64: error: non-member function 'bool smart_pointer::operator!=(const smart_pointer::SmartPointer<U, AnotherAllocator>&)' cannot have cv-qualifier
 bool operator!=(const SmartPointer<U, AnotherAllocator> & ptr) const {
                                                                ^~~~~
SmartPointer.hpp:129:64: error: 'bool smart_pointer::operator!=(const smart_pointer::SmartPointer<U, AnotherAllocator>&)' must take exactly two arguments
SmartPointer.hpp:132:28: error: non-member function 'std::size_t smart_pointer::count_owners()' cannot have cv-qualifier
 std::size_t count_owners() const {
                            ^~~~~
SmartPointer.hpp: In function 'std::size_t smart_pointer::count_owners()':
SmartPointer.hpp:133:5: error: invalid use of 'this' in non-member function
 if (this->core != nullptr) {
     ^~~~
SmartPointer.hpp:134:8: error: invalid use of 'this' in non-member function
 return this->core->count;
        ^~~~
SmartPointer.hpp: At global scope:
SmartPointer.hpp:140:2: error: expected unqualified-id before 'private'
  private:
  ^~~~~~~
SmartPointer.hpp:151:1: error: 'Core' does not name a type
 Core *core;
 ^~~~
SmartPointer.hpp:153:1: error: expected declaration before '}' token
 }
 ^
[печатать | |
]
(3 038 b)
0.063s 0.014s 10