Revision 1247 trunk/src/linad99/dvector.cpp

dvector.cpp (revision 1247)
48 48
  return *this;
49 49
}
50 50

  
51
 /**
52
 Default destructor. Invoked by the compiler. Only frees allocated memory
53
 if all shallow copies in scope have been removed.
54
 */
55
 dvector::~dvector()
56
 {
57
   if (shape)
58
   {
59
     if (shape->ncopies)
60
     {
61
       (shape->ncopies)--;
62
     }
63
     else
64
     {
65
       #ifdef DIAG
66
         myheapcheck(" Entering ~dvector");
67
       #endif
51
/**
52
Default destructor. Invoked by the compiler. Only frees allocated memory
53
if all shallow copies in scope have been removed.
54
*/
55
dvector::~dvector()
56
{
57
  if (shape)
58
  {
59
    if (shape->ncopies)
60
    {
61
      (shape->ncopies)--;
62
    }
63
    else
64
    {
65
      #ifdef DIAG
66
      myheapcheck(" Entering ~dvector");
67
      #endif
68
      if (v == NULL)
69
      {
70
        cerr << " Trying to delete NULL pointer in ~dvector\n";
71
        ad_exit(21);
72
      }
73
      deallocate();
74
    }
75
  }
76
}
68 77

  
69
       if ( v == NULL)
70
       {
71
         cerr << " Trying to delete NULL pointer in ~dvector\n";
72
         ad_exit(21);
73
       }
74
       deallocate();
75
     }
76
   }
77
 }
78

  
79 78
static int testflag=0;
80 79
static int ycounter=0;
81 80
  /** Deallocates memory for a dvector object.

Also available in: Unified diff