fork download
  1. #include <iostream>
  2. #include <memory>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7.  
  8. allocator< int[] > allo;
  9.  
  10. int *ptr = new int[10];
  11.  
  12. allo.deallocate(ptr, 10);
  13.  
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 3336KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:12:25: error: no matching function for call to ‘std::allocator<int []>::deallocate(int*&, int)’
  allo.deallocate(ptr, 10);
                         ^
prog.cpp:12:25: note: candidate is:
In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/c++allocator.h:33:0,
                 from /usr/include/c++/4.8/bits/allocator.h:46,
                 from /usr/include/c++/4.8/string:41,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/4.8/ext/new_allocator.h:109:7: note: void __gnu_cxx::new_allocator<_Tp>::deallocate(__gnu_cxx::new_allocator<_Tp>::pointer, __gnu_cxx::new_allocator<_Tp>::size_type) [with _Tp = int []; __gnu_cxx::new_allocator<_Tp>::pointer = int (*)[]; __gnu_cxx::new_allocator<_Tp>::size_type = unsigned int]
       deallocate(pointer __p, size_type)
       ^
/usr/include/c++/4.8/ext/new_allocator.h:109:7: note:   no known conversion for argument 1 from ‘int*’ to ‘__gnu_cxx::new_allocator<int []>::pointer {aka int (*)[]}’
stdout
Standard output is empty