Boost logo

Boost Users :

From: Oliver.Kowalke_at_[hidden]
Date: 2005-10-27 08:36:12


>>no reply - so I found a solution by myself (used for the Barton &
>> Nackmann trick)!
>> template< typename D >
>> struct F
>> {
>> std::string f()
>> { return static_cast< D & >( * this).str_; }
>> };
>>
>> template< typename D >
>> struct G
>> {
>> std::string g()
>> { return static_cast< D & >( * this).str_; }
>> };
>
>That's not the B&N trick; it's simple CRTP.
>The B&N trick is the one where you stick a friend function that
>applies to the derived class in the base class. See the operators
>library for reference.

Sorry - in your book (C++ Template Metaprogramming, page 205) I can
read:
"The technique of using a static_cast with CRTP to reach the derived
object is sometimes called the "Barton and Nackmann trick" ...".
Is this wrong?

So long,
Oliver


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net