Ticket #89 (closed defect: fixed)

Opened 2 years ago

Last modified 2 months ago

dynamic cast

Reported by: dirk Assigned to: unassigned
Priority: major Milestone: 2.0 Beta
Component: System Version:
Keywords: Cc:
Completion:

Description

In 1 the dynamic casts were done using ::dcast. Currently they use cast_dynamic in 2. We should at least have a backwards compatibility option, if we keep the change.

Maybe all this will be obsolete with the CPtrs, but just to keep it in mind a ticket is useful.

Change History

(follow-up: ↓ 3 ) 10/09/06 08:40:38 changed by vossg

do you have a specific case ?. Ptr::dcast should be available with OSG_1_COMPAT set.

10/09/06 08:57:41 changed by allenb

This is purely personally preference, but I don't like the name cast_dynamic because in code it looks like a misspelled version of dynamic_cast. That is pretty confusing in my opinion. What about using dynamic_pointer_cast≠ like boost does or even a global OSG::dcast≠ method?

(in reply to: ↑ 1 ) 10/09/06 09:09:27 changed by dirk

Replying to vossg:

do you have a specific case ?. Ptr::dcast should be available with OSG_1_COMPAT set.

I hadn't seen that, sorry.

07/21/07 05:31:13 changed by marcusl

Hasn't the cptrs been ported in to trunk now? Thus someone can use dynamic_cast everywhere and never use dcast? This makes the whole ticket quite moot?

05/20/08 10:21:50 changed by cneumann

  • status changed from new to closed.
  • resolution set to fixed.

RefCountPtr need to be cast with dynamic_pointer_cast or static_pointer_cast (see also Dev/DevDesignNotes). There are overloads of these functions that work on raw pointers as well (as of r1236), so they can be used in places where one would normally use dynamic_cast/static_cast to have a uniform look for all casts.