Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2002-02-03 10:51:18

on 2/2/02 11:32 PM, Gustavo Guerra at gustavobt_at_[hidden] wrote:

> ----- Original Message -----
> From: "Daryle Walker" <darylew_at_[hidden]>
>> on 2/1/02 6:27 PM, Gustavo Guerra at gustavobt_at_[hidden] wrote:
>> [SNIP]
>>> I took a look at the proposal, and there's no macros on the interface. He
>>> just used macros on the implementation to avoid repetition, where he could
>>> have used the Currioulsy Recuring Template pattern. Isn't the interface the
>>> important thing here?
>> How would you have used the Curiously Recurring Template pattern here?
> Well, maybe I rushed into conclusions too fast. Sorry. I just assumed that the
> CRT was what you tried to use but your compiler didn't let you, as I took a
> _very_quick_ look at your code and was the only thing I could remeber that
> needed a littel more template support from the compiler to avoid that kind of
> repetition you avoided with those macros (remembering
> But looking
> closely, maybe it doesn't apply in this case. If it wasn't the CRT, what else
> did you experiment to replace the macros then?

I tried something like

template < class ObjectType, typename AspectType, AspectType (ObjectType::*
Getter)(), AspectType (ObjectType::* GetSetter)(AspectType) >
class get_set_base
    explicit get_set_base( ObjectType &o )
              : s_( &o ), a_( o.*Getter() )
             get_set_base( ObjectType &o, AspectType a )
              : s_( &o ), a_( o.*GetSetter(a) )
              { s_->*GetSetter(a_); }

    ObjectType * const s_;
    AspectType const a_;

But my compiler choked on the third template parameter, saying it was an
unimplemented feature.

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Boost list run by bdawes at, gregod at, cpdaniel at, john at