473,387 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

issue deleting template class object

I have defined a template class (tree data structure) that uses dynamic
memory and has properly implemented ctor's, dtor and assignment
operator. I can observe the address of my tree object prior to the
destructor being called, and then the address once inside the
destructor...they're different! The following calls are on the stack
between the call to my destructor and the actual destructor itself:

`eh vector destructor iterator'(void * ptr=0x00a6c454, ...)
`vector deleting destructor'()

I've also noticed that the address passed as "ptr" in the "eh vector
destructor iterator" is the address that my tree object has once inside
the destructor (again...it's not the same address prior to the
destructor being called). This is causing a run time exception (the
passed address points somewhere that isn't initialized to anything).

What exactly do the above methods do? BTW, I'm debugging with MS VC++
..NET.

Jan 9 '07 #1
2 2946
maynard wrote:
I have defined a template class (tree data structure) that uses
dynamic memory and has properly implemented ctor's, dtor and
assignment operator. I can observe the address of my tree object
prior to the destructor being called, and then the address once
inside the destructor...they're different! The following calls are
on the stack between the call to my destructor and the actual
destructor itself:

`eh vector destructor iterator'(void * ptr=0x00a6c454, ...)
`vector deleting destructor'()

I've also noticed that the address passed as "ptr" in the "eh vector
destructor iterator" is the address that my tree object has once
inside the destructor (again...it's not the same address prior to the
destructor being called). This is causing a run time exception (the
passed address points somewhere that isn't initialized to anything).

What exactly do the above methods do? BTW, I'm debugging with MS VC++
.NET.
It might be best to ask in a VC++ newsgroup. Unless you feel like
following the recommendations of FAQ 5.8.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jan 9 '07 #2
maynard wrote:
I have defined a template class (tree data structure) that uses dynamic
memory and has properly implemented ctor's, dtor and assignment
operator. I can observe the address of my tree object prior to the
destructor being called, and then the address once inside the
destructor...they're different! The following calls are on the stack
between the call to my destructor and the actual destructor itself:

`eh vector destructor iterator'(void * ptr=0x00a6c454, ...)
`vector deleting destructor'()

I've also noticed that the address passed as "ptr" in the "eh vector
destructor iterator" is the address that my tree object has once inside
the destructor (again...it's not the same address prior to the
destructor being called). This is causing a run time exception (the
passed address points somewhere that isn't initialized to anything).
Are you slicing the object ?

Slicing refers to objects with a non-virtual destructor where you end up
deleting the wrong object. The same happens with copies.
Jan 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Tony Johansson | last post by:
Hello Experts! What does this mean actually. If you have a template with a type and non-type template argument, say, like this template<typename T, int a> class Array {. . .}; then A<int,...
12
by: Ken | last post by:
I am familiar with C and Java, I would like to use a style that I have become accustomed to in Java with C++ but each time I do this I have name conflict. In the past I have just worked around it...
4
by: al havrilla | last post by:
hi all what does the phrase: "scalar deleting destructor" mean? i'm getting this in a debug error message using c++ 7.1 thanks Al
3
by: IR | last post by:
Hi, I've been trying to do the following (which doesn't compile) : template<class T, class F = Example<T struct Example { F foo(); };
8
by: obrianpatrick | last post by:
Hi, I am relatively new to object oriented programming and design. I am developing an application in VS 2005. I am having the following design problem: I have two interfaces X and Y. Y is...
6
by: bogus1one | last post by:
Hi All Given the following: // NamespaceTemplate.cpp : Defines the entry point for the console application. // #include "stdafx.h"
4
by: Alexander Adam | last post by:
Hello folks, I got a few question on some basic data structure stuff. Sorry if those questions might sound too easy or such but after googling a lot I didn't find a real answer to all those...
2
by: Kai-Uwe Bux | last post by:
Does the following have undefined behavior? struct X; struct Y { X * x_ptr; Y ( void ) : x_ptr ( 0 )
6
by: Lawrence Spector | last post by:
I ran into a problem using g++. Visual Studio 2005 never complained about this, but with g++ I ran into this error. I can't figure out if I've done something wrong or if this is a compiler bug. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.