Opened 5 years ago
Last modified 5 years ago
#136 new enhancement
PtrsAssignable Rework
Reported by: | ajbeach | Owned by: | |
---|---|---|---|
Priority: | major | Component: | cfa-cc |
Version: | 1.0 | Keywords: | |
Cc: |
Description
The visitor used to implement part of the helper function is almost entirely boiler plate. It never recurses (not even manually) and most of the functions don't do anything.
The entire thing should be easy to replace with a pair of if statements which check for a successful dynamic_cast. The bodies of the if statements being the bodies of the few postvisit functions that actually do anything.
Change History (3)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
I think the suggestion was to replace the visitor with a function of the following form, rather than change the semantics:
if ( auto foo = dynamic_cast< Foo * >( x ) ) { // do stuff } else if ( auto bar = dynamic_cast< Bar * >( x ) ) { // do other stuff }
Note: See
TracTickets for help on using
tickets.
Definitely verify this, but if memory serves then this does not recurse for a reason. I think it's the case that you don't want to be able to directly assign multilevel pointers of different types, which would be allowed for void * and T *. For example:
I'm fairly certain this is the case that's being handled by not recursing here (well, general argument passing, not just assignment, despite the name).