Run Code  | API  | Code Wall  | Users  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Smart Pointers

Language: Layout:
+ ] Compiler args + ] Show input
Compilation time: 1.74 sec, absolute service time: 1,75 sec 
edit mode |  history  | discussion
Error(s):
source_file.cpp:18:22: error: template argument 1 is invalid
  vector<SmartPointer*> all;
                      ^
source_file.cpp:18:22: error: template argument 2 is invalid
source_file.cpp: In member function ‘myType* SmartPointerHelper::get_new()’:
source_file.cpp:23:7: error: request for member ‘push_back’ in ‘((SmartPointerHelper*)this)->SmartPointerHelper::all’, which is of non-class type ‘int’
   all.push_back(new SmartPointer<myType>(ptr));
       ^
source_file.cpp: In destructor ‘SmartPointerHelper::~SmartPointerHelper()’:
source_file.cpp:30:30: error: request for member ‘size’ in ‘((SmartPointerHelper*)this)->SmartPointerHelper::all’, which is of non-class type ‘int’
         for(int j = (int)all.size()-1; j >= 0; j--) delete(all[j]);
                              ^
source_file.cpp:30:65: error: invalid types ‘int[int]’ for array subscript
         for(int j = (int)all.size()-1; j >= 0; j--) delete(all[j]);
                                                                 ^
source_file.cpp: In function ‘int main()’:
source_file.cpp:52:7: warning: unused variable ‘dynamic_int’ [-Wunused-variable]
  int *dynamic_int = smp.get_new<int>();
       ^
source_file.cpp:53:8: warning: unused variable ‘dynamic_node’ [-Wunused-variable]
  node* dynamic_node = smp.get_new<node>();
        ^