|
|
printing mat3 0 101 1010 1111 10100 10201 11110 11211 *** glibc detected *** ./a.out: double free or corruption (top): 0x084fb070 *** ======= Backtrace: ========= /lib/i386-linux-gnu/libc.so.6(+0x75ee2)[0x37bee2] /usr/lib/i386-linux-gnu/libstdc++.so.6(_ZdlPv+0x1f)[0x21651f] /usr/lib/i386-linux-gnu/libstdc++.so.6(_ZdaPv+0x1b)[0x21657b] ./a.out[0x8048779] ./a.out[0x8048c0b] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x31f4d3] ./a.out[0x8048641] ======= Memory map: ======== ..... ..... ..... b7731000-b7734000 rw-p 00000000 00:00 0 b774b000-b774f000 rw-p 00000000 00:00 0 bf8dc000-bf8fd000 rw-p 00000000 00:00 0 [stack] Aborted (core dumped) |
array3d array3d::operator + (array3d mat)
array3d array3d::operator + (array3d& mat)
array3d::array3d (int u, int v, int x)
vichu8888 wrote: |
---|
"so take out that destructor and you didnt implement the default constructor." |
Framework wrote: |
---|
The compiler-generated default constructor is called a trival constructor, which basically means "do nothing". |
[12.1.5] A default constructor is trivial if it is not user-provided and if: — its class has no virtual functions (10.3) and no virtual base classes (10.1), and — no non-static data member of its class has a brace-or-equal-initializer, and — all the direct base classes of its class have trivial default constructors, and — for all the non-static data members of its class that are of class type (or array thereof), each such class has a trivial default constructor. |
|
|
[12.7.12] A copy/move constructor for class X is trivial if it is not user-provided and if — class X has no virtual functions (10.3) and no virtual base classes (10.1), and — the constructor selected to copy/move each direct base class subobject is trivial, and — for each non-static data member of X that is of class type (or array thereof), the constructor selected to copy/move that member is trivial; otherwise the copy/move constructor is non-trivial. |
[12.4.5] A destructor is trivial if it is not user-provided and if: — the destructor is not virtual, — all of the direct base classes of its class have trivial destructors, and — for all of the non-static data members of its class that are of class type (or array thereof), each such class has a trivial destructor. Otherwise, the destructor is non-trivial. |