On Fri, Mar 26, 2010 at 12:20 AM, Chris Vine
<[email protected]> wrote:
> On Thu, 25 Mar 2010 23:45:24 +0100
> Murray Cumming <[email protected]> wrote:
>> On Thu, 2010-03-25 at 14:58 -0500, Jonathon Jongsma wrote:
>> > For example, the following commonly-used one-liner:
>> > tree_view.get_selection()->set_mode(...);
>> >
>> > would become (without validity-checking):
>> > tree_view.get_selection().lock()->set_mode(...);
>>

BTW

tree_view.get_selection().lock()->set_mode(...);

would be the same as

ptr = tree_view.get_selection().lock();
assert(ptr != NULL);
ptr->set_mode(...);

The assertion is actually included in the operator->() of the boost
smart pointer.

This is somewhat safer than using "simple" pointers, because in this
case you are guaranteed that your program will halt with a failed
assertion, instead of randomly access to an invalid memory area.
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to