|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-02-11 22:53:15
"Powell, Gary" <powellg_at_[hidden]> writes:
> --------------------------------
> If Rani is right about the reference binding I'd like to find some way
> to library-ize this idiom, so your "ref" converting constructor will
> come in handy. BTW, you don't need the other "ref" constructor
> anymore.
>
> --
> Dave Abrahams
> ----------------------------------------------------------------------
>
> Ok, reusing Andrei's mojo name I've got the following working:
<snip>
> And it all seems to work correctly.
Nifty, but I think avoiding code duplication in constructors (using
preprocessor macros) should be a higher priority than CRTP. In fact,
I'm not very convinced that CRTP is of much benefit in this case.
> IMO it's not too bad of a "library" module. In any case I like using
> the operator->() as you can stop referencing the pointer
> "ref.p". And I chose operator &() but perhaps a "get() member fn of
> mojo is the right thing to do. As to whether to call it mojo or
> not...well I didn't have another class name in mind.
>
> If you don't have mulitiple inheritence you don't have to specify
> mojo<Type>::ref, so that's nice as well.
>
> Anyway I saw Bjarne's call for items on the list, and IMO, this
> topic deserves it if nothing more than to clarify that its OK.
Why don't you respond?
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk