fork(10) download
  1. #include <memory>
  2.  
  3. template <typename T, typename A = std::allocator<T> >
  4. class B{
  5. public:
  6. char* hoge(){
  7. typename A::rebind<char>::other d;
  8. return d.allocate(1);
  9. }
  10. };
  11.  
  12. int main(){
  13. B<int> b;
  14. b.hoge();
  15. return 0;
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function ‘char* B<T, A>::hoge()’:
prog.cpp:7: error: non-template ‘rebind’ used as template
prog.cpp:7: note: use ‘A::template rebind’ to indicate that it is a template
prog.cpp:7: error: declaration does not declare anything
prog.cpp:8: error: ‘d’ was not declared in this scope
stdout
Standard output is empty