ID 5968134
Пользователь Затрутин Роман Сергеевич
Время 15:03<< 11.01.2022 15:04 (0:08) 15:04>>
Обработка 15:04 ... 15:04 (3,75 сек.)
Файл 5968134.cpp (CLang++ 5.0.0 + Address Sanitizer)
Турнир 2 курс. Программирование на C++. Турнир 2, осень 2021
Задача D: FixedAllocator
Набор тестов
Ограничения Время: 2с Память: 128Мб
Состояние  [?]
CE Ошибка компиляции
код | результаты
In file included from main.cpp:28:0:
fixed_allocator.h:7:24: error: 'GameObject' does not name a type
 bool compareById(const GameObject& a, const GameObject& b) {
                        ^~~~~~~~~~
fixed_allocator.h:7:45: error: 'GameObject' does not name a type
 bool compareById(const GameObject& a, const GameObject& b) {
                                             ^~~~~~~~~~
fixed_allocator.h: In function 'bool compareById(const int&, const int&)':
fixed_allocator.h:8:12: error: request for member 'id' in 'a', which is of non-class type 'const int'
   return a.id > b.id;
            ^~
fixed_allocator.h:8:19: error: request for member 'id' in 'b', which is of non-class type 'const int'
   return a.id > b.id;
                   ^~
fixed_allocator.h: At global scope:
fixed_allocator.h:13:17: error: 'ObjectId' has not been declared
   int Get_Index(ObjectId id) {
                 ^~~~~~~~
fixed_allocator.h:20:15: error: 'GameObject' was not declared in this scope
   std::vector<GameObject> db_;
               ^~~~~~~~~~
fixed_allocator.h:20:25: error: template argument 1 is invalid
   std::vector<GameObject> db_;
                         ^
fixed_allocator.h:20:25: error: template argument 2 is invalid
fixed_allocator.h:25:15: error: 'ObjectId' has not been declared
   void Insert(ObjectId id, string name, size_t x, size_t y) {
               ^~~~~~~~
fixed_allocator.h:25:28: error: 'string' has not been declared
   void Insert(ObjectId id, string name, size_t x, size_t y) {
                            ^~~~~~
fixed_allocator.h:34:15: error: 'ObjectId' has not been declared
   void Remove(ObjectId id) {
               ^~~~~~~~
fixed_allocator.h:40:3: error: 'vector' does not name a type; did you mean 'perror'?
   vector<GameObject> DataByName(string name) const {
   ^~~~~~
   perror
fixed_allocator.h:49:3: error: 'vector' does not name a type; did you mean 'perror'?
   vector<GameObject> DataByPosition(size_t x, size_t y) const {
   ^~~~~~
   perror
fixed_allocator.h:58:3: error: 'vector' does not name a type; did you mean 'perror'?
   vector<GameObject> Data() const {
   ^~~~~~
   perror
fixed_allocator.h: In member function 'int GameDatabase::Get_Index(int)':
fixed_allocator.h:14:38: error: request for member 'size' in '((GameDatabase*)this)->GameDatabase::db_', which is of non-class type 'int'
     for (unsigned int i = 0; i < db_.size(); i++) {
                                      ^~~~
fixed_allocator.h:15:16: error: invalid types 'int[unsigned int]' for array subscript
       if (db_[i].id == id)
                ^
fixed_allocator.h: In member function 'void GameDatabase::Insert(int, int, size_t, size_t)':
fixed_allocator.h:28:11: error: request for member 'push_back' in '((GameDatabase*)this)->GameDatabase::db_', which is of non-class type 'int'
       db_.push_back({ id, name, x, y });
           ^~~~~~~~~
fixed_allocator.h:30:17: error: invalid types 'int[int]' for array subscript
       db_[new_id] = {id, name, x, y};
                 ^
fixed_allocator.h: In member function 'void GameDatabase::Remove(int)':
fixed_allocator.h:37:11: error: request for member 'erase' in '((GameDatabase*)this)->GameDatabase::db_', which is of non-class type 'int'
       db_.erase(db_.begin() + new_id);
           ^~~~~
fixed_allocator.h:37:21: error: request for member 'begin' in '((GameDatabase*)this)->GameDatabase::db_', which is of non-class type 'int'
       db_.erase(db_.begin() + new_id);
                     ^~~~~
main.cpp: In function 'int main()':
main.cpp:44:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<int> a(1);
         ^~~~~~~~~~~~~~
main.cpp:44:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<int> a(1);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:44:24: error: expected primary-expression before 'int'
         FixedAllocator<int> a(1);
                        ^~~
main.cpp:45:19: error: 'a' was not declared in this scope
         auto p1 = a.Allocate();
                   ^
main.cpp:55:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<std::string> a(10);
         ^~~~~~~~~~~~~~
main.cpp:55:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<std::string> a(10);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:55:35: error: expected primary-expression before '>' token
         FixedAllocator<std::string> a(10);
                                   ^
main.cpp:55:37: error: 'a' was not declared in this scope
         FixedAllocator<std::string> a(10);
                                     ^
main.cpp:62:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<std::string> a(100);
         ^~~~~~~~~~~~~~
main.cpp:62:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<std::string> a(100);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:62:35: error: expected primary-expression before '>' token
         FixedAllocator<std::string> a(100);
                                   ^
main.cpp:62:37: error: 'a' was not declared in this scope
         FixedAllocator<std::string> a(100);
                                     ^
main.cpp:69:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<std::string> a(1);
         ^~~~~~~~~~~~~~
main.cpp:69:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<std::string> a(1);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:69:35: error: expected primary-expression before '>' token
         FixedAllocator<std::string> a(1);
                                   ^
main.cpp:69:37: error: 'a' was not declared in this scope
         FixedAllocator<std::string> a(1);
                                     ^
main.cpp:76:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<std::string> a(1);
         ^~~~~~~~~~~~~~
main.cpp:76:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<std::string> a(1);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:76:35: error: expected primary-expression before '>' token
         FixedAllocator<std::string> a(1);
                                   ^
main.cpp:76:37: error: 'a' was not declared in this scope
         FixedAllocator<std::string> a(1);
                                     ^
main.cpp:86:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<std::string> a(100);
         ^~~~~~~~~~~~~~
main.cpp:86:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<std::string> a(100);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:86:35: error: expected primary-expression before '>' token
         FixedAllocator<std::string> a(100);
                                   ^
main.cpp:86:37: error: 'a' was not declared in this scope
         FixedAllocator<std::string> a(100);
                                     ^
main.cpp:96:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<std::string> a(100);
         ^~~~~~~~~~~~~~
main.cpp:96:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<std::string> a(100);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:96:35: error: expected primary-expression before '>' token
         FixedAllocator<std::string> a(100);
                                   ^
main.cpp:96:37: error: 'a' was not declared in this scope
         FixedAllocator<std::string> a(100);
                                     ^
main.cpp:106:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<std::string> a(1000000);
         ^~~~~~~~~~~~~~
main.cpp:106:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<std::string> a(1000000);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:106:35: error: expected primary-expression before '>' token
         FixedAllocator<std::string> a(1000000);
                                   ^
main.cpp:106:37: error: 'a' was not declared in this scope
         FixedAllocator<std::string> a(1000000);
                                     ^
main.cpp:116:9: error: 'FixedAllocator' was not declared in this scope
         FixedAllocator<char> a(100);
         ^~~~~~~~~~~~~~
main.cpp:116:9: note: suggested alternative: 'PageAllocator'
         FixedAllocator<char> a(100);
         ^~~~~~~~~~~~~~
         PageAllocator
main.cpp:116:24: error: expected primary-expression before 'char'
         FixedAllocator<char> a(100);
                        ^~~~
main.cpp:119:29: error: 'a' was not declared in this scope
             store.push_back(a.Allocate());
                             ^
main.cpp:123:13: error: 'a' was not declared in this scope
             a.Deallocate(store[rnd]);
             ^
[печатать | |
]
(1 415 b)
0.041s 0.009s 10