It's not neccessary to do anything to the std::string in the ustring dtor;
the std::string is not dynamically allocated and its dtor will be called
with position in sequence depening on the structure of the ustring class
once the ustring dtor is being called. There is no need to use ::clear() to
(it's what I think you meant) clear up any memory used by the std::string.
std::string's own dtor will then free any memory internally allocated by it.

On Wed, Sep 22, 2010 at 11:00 PM, Piscium <[email protected]> wrote:

> I took a peek at the ustring source code. A ustring is stored like this:
>
> std::string string_;
>
> And this is the the ustring dtor:
>
> ustring::~ustring()
> {}
>
> Note that it is an empty function.
>
> I have a question, just for my own education, as I am a beginner in C++.
>
> Why wasn't the dtor defined instead like below?
>
> ustring::~ustring()
> {string_.clear()}
> _______________________________________________
> gtkmm-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>



-- 
Please note that according to the German law on data retention,
information on every electronic information exchange with me is
retained for a period of six months.
[Bitte beachten Sie, dass dem Gesetz zur Vorratsdatenspeicherung zufolge
jeder elektronische Kontakt mit mir sechs Monate lang gespeichert wird.]
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to