ID 5731628
Пользователь Борцов Роман Александрович
Время 16:36<< 11.11.2021 16:43 (22 д. 14:44) 14.11.2021 15:42>>
Обработка 16:43 ... 16:43 (3,03 сек.)
Файл 5731628.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: In member function 'Tp* FixedAllocator<Tp>::Allocate()':
fixed_allocator.h:16:44: error: expected type-specifier before ';' token
             p = new(sizeof(Tp) * page_size);
                                            ^
fixed_allocator.h: In instantiation of 'FixedAllocator<Tp>::FixedAllocator(uint64_t) [with Tp = int; uint64_t = long unsigned int]':
main.cpp:44:32:   required from here
fixed_allocator.h:9:75: error: no matching function for call to 'PageAllocator::PageAllocator()'
     explicit FixedAllocator(std::uint64_t page_size) : page_size(page_size) {}
                                                                           ^
main.cpp:9:5: note: candidate: PageAllocator::PageAllocator(uint64_t)
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:9:5: note:   candidate expects 1 argument, 0 provided
main.cpp:4:7: note: candidate: PageAllocator::PageAllocator(const PageAllocator&)
 class PageAllocator {
       ^~~~~~~~~~~~~
main.cpp:4:7: note:   candidate expects 1 argument, 0 provided
In file included from main.cpp:28:0:
fixed_allocator.h: In instantiation of 'FixedAllocator<Tp>::~FixedAllocator() [with Tp = int]':
main.cpp:44:32:   required from here
fixed_allocator.h:11:9: error: type 'class PageAllocator' argument given to 'delete', expected pointer
         delete page_allocator_;
         ^~~~~~
fixed_allocator.h: In instantiation of 'Tp* FixedAllocator<Tp>::Allocate() [with Tp = int]':
main.cpp:45:30:   required from here
fixed_allocator.h:19:29: error: invalid user-defined conversion from 'PageAllocator*' to 'const PageAllocator&' [-fpermissive]
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:5: note: candidate is: PageAllocator::PageAllocator(uint64_t) <near match>
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:9:5: note:   conversion of argument 1 would be ill-formed:
In file included from main.cpp:28:0:
fixed_allocator.h:19:29: error: invalid conversion from 'PageAllocator*' to 'uint64_t {aka long unsigned int}' [-fpermissive]
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fixed_allocator.h:19:29: error: invalid conversion from 'PageAllocator*' to 'uint64_t {aka long unsigned int}' [-fpermissive]
main.cpp:9:5: note:   initializing argument 1 of 'PageAllocator::PageAllocator(uint64_t)'
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:4:7: note:   initializing argument 1 of 'PageAllocator& PageAllocator::operator=(const PageAllocator&)'
 class PageAllocator {
       ^~~~~~~~~~~~~
In file included from main.cpp:28:0:
fixed_allocator.h:19:29: error: use of deleted function 'PageAllocator& PageAllocator::operator=(const PageAllocator&)'
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:4:7: note: 'PageAllocator& PageAllocator::operator=(const PageAllocator&)' is implicitly deleted because the default definition would be ill-formed:
 class PageAllocator {
       ^~~~~~~~~~~~~
main.cpp:4:7: error: non-static const member 'const uint64_t PageAllocator::page_size_', can't use default assignment operator
In file included from main.cpp:28:0:
fixed_allocator.h: In instantiation of 'FixedAllocator<Tp>::FixedAllocator(uint64_t) [with Tp = std::__cxx11::basic_string<char>; uint64_t = long unsigned int]':
main.cpp:55:41:   required from here
fixed_allocator.h:9:75: error: no matching function for call to 'PageAllocator::PageAllocator()'
     explicit FixedAllocator(std::uint64_t page_size) : page_size(page_size) {}
                                                                           ^
main.cpp:9:5: note: candidate: PageAllocator::PageAllocator(uint64_t)
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:9:5: note:   candidate expects 1 argument, 0 provided
main.cpp:4:7: note: candidate: PageAllocator::PageAllocator(const PageAllocator&)
 class PageAllocator {
       ^~~~~~~~~~~~~
main.cpp:4:7: note:   candidate expects 1 argument, 0 provided
In file included from main.cpp:28:0:
fixed_allocator.h: In instantiation of 'FixedAllocator<Tp>::~FixedAllocator() [with Tp = std::__cxx11::basic_string<char>]':
main.cpp:55:41:   required from here
fixed_allocator.h:11:9: error: type 'class PageAllocator' argument given to 'delete', expected pointer
         delete page_allocator_;
         ^~~~~~
fixed_allocator.h: In instantiation of 'Tp* FixedAllocator<Tp>::Allocate() [with Tp = std::__cxx11::basic_string<char>]':
main.cpp:57:24:   required from here
fixed_allocator.h:19:29: error: invalid user-defined conversion from 'PageAllocator*' to 'const PageAllocator&' [-fpermissive]
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:5: note: candidate is: PageAllocator::PageAllocator(uint64_t) <near match>
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:9:5: note:   conversion of argument 1 would be ill-formed:
In file included from main.cpp:28:0:
fixed_allocator.h:19:29: error: invalid conversion from 'PageAllocator*' to 'uint64_t {aka long unsigned int}' [-fpermissive]
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fixed_allocator.h:19:29: error: invalid conversion from 'PageAllocator*' to 'uint64_t {aka long unsigned int}' [-fpermissive]
main.cpp:9:5: note:   initializing argument 1 of 'PageAllocator::PageAllocator(uint64_t)'
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:4:7: note:   initializing argument 1 of 'PageAllocator& PageAllocator::operator=(const PageAllocator&)'
 class PageAllocator {
       ^~~~~~~~~~~~~
In file included from main.cpp:28:0:
fixed_allocator.h:19:29: error: use of deleted function 'PageAllocator& PageAllocator::operator=(const PageAllocator&)'
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fixed_allocator.h: In instantiation of 'FixedAllocator<Tp>::FixedAllocator(uint64_t) [with Tp = char; uint64_t = long unsigned int]':
main.cpp:116:35:   required from here
fixed_allocator.h:9:75: error: no matching function for call to 'PageAllocator::PageAllocator()'
     explicit FixedAllocator(std::uint64_t page_size) : page_size(page_size) {}
                                                                           ^
main.cpp:9:5: note: candidate: PageAllocator::PageAllocator(uint64_t)
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:9:5: note:   candidate expects 1 argument, 0 provided
main.cpp:4:7: note: candidate: PageAllocator::PageAllocator(const PageAllocator&)
 class PageAllocator {
       ^~~~~~~~~~~~~
main.cpp:4:7: note:   candidate expects 1 argument, 0 provided
In file included from main.cpp:28:0:
fixed_allocator.h: In instantiation of 'FixedAllocator<Tp>::~FixedAllocator() [with Tp = char]':
main.cpp:116:35:   required from here
fixed_allocator.h:11:9: error: type 'class PageAllocator' argument given to 'delete', expected pointer
         delete page_allocator_;
         ^~~~~~
fixed_allocator.h: In instantiation of 'Tp* FixedAllocator<Tp>::Allocate() [with Tp = char]':
main.cpp:119:40:   required from here
fixed_allocator.h:19:29: error: invalid user-defined conversion from 'PageAllocator*' to 'const PageAllocator&' [-fpermissive]
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:5: note: candidate is: PageAllocator::PageAllocator(uint64_t) <near match>
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:9:5: note:   conversion of argument 1 would be ill-formed:
In file included from main.cpp:28:0:
fixed_allocator.h:19:29: error: invalid conversion from 'PageAllocator*' to 'uint64_t {aka long unsigned int}' [-fpermissive]
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fixed_allocator.h:19:29: error: invalid conversion from 'PageAllocator*' to 'uint64_t {aka long unsigned int}' [-fpermissive]
main.cpp:9:5: note:   initializing argument 1 of 'PageAllocator::PageAllocator(uint64_t)'
     PageAllocator(std::uint64_t page_size) : page_size_(page_size) {
     ^~~~~~~~~~~~~
main.cpp:4:7: note:   initializing argument 1 of 'PageAllocator& PageAllocator::operator=(const PageAllocator&)'
 class PageAllocator {
       ^~~~~~~~~~~~~
In file included from main.cpp:28:0:
fixed_allocator.h:19:29: error: use of deleted function 'PageAllocator& PageAllocator::operator=(const PageAllocator&)'
             page_allocator_ = new PageAllocator(page_size);
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0.042s 0.009s 9