Guest User

Untitled

a guest
Jan 20th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. template< typename T > struct FixedVector
  2. {
  3. T * ptr;
  4. size_t count;
  5.  
  6. typedef T value_type;
  7.  
  8. FixedVector():ptr(0),count(0) {}
  9. ~FixedVector()
  10. {
  11. DeleteArr(ptr); // Error message appears here
  12. count=0;
  13. }
  14. // ...
  15. }
  16.  
  17. template< typename T > inline void DeleteArr( T *& ptr )
  18. {
  19. delete[] ptr;
  20. ptr = NULL;
  21. }
  22.  
  23. error: call to function 'DeleteArr' that is neither visible in the template definition nor found by argument-dependent lookup
  24.  
  25. 'DeleteArr' should be declared prior to the call site or in an associated namespace of one of its arguments.
  26.  
  27. template< typename T > inline void DeleteArr( T *& ptr );
  28.  
  29. template< typename T > inline void DeleteArr( T *& ptr )
  30. {
  31. delete[] ptr;
  32. ptr = NULL;
  33. }
  34.  
  35. template< typename T > struct FixedVector
  36. {
  37. T * ptr;
  38. size_t count;
  39.  
  40. typedef T value_type;
  41.  
  42. FixedVector():ptr(0),count(0) {}
  43. ~FixedVector()
  44. {
  45. DeleteArr(ptr); // Error message appears here
  46. count=0;
  47. }
  48. // ...
  49. }
Add Comment
Please, Sign In to add comment