Boost logo

Boost :

From: Rene Rivera (grafik666_at_[hidden])
Date: 2002-11-01 18:15:53


[2002-11-01] Arkadiy Vertleyb wrote:

>The FIELD macro is used to access a field inside a tuple. It unwraps into
>the call to the templated method on the tuple class that further calls
>static_cast to access the field. So we now have:
>
>FIELD(tuple, c1) = 5; // we have it now
>
>but would like to have:
>
>tuple.field<c1>() = 5; // we want it like this
>
>Neither MSVC nor g++ allows us to do this. Is there anything about the
>standard that makes it illigal? The best we could do is:
>
>tuple.field((c1*)0) = 5; // pretty ugly, isn't it?
>
>So, we decided to have the macro :o((

I have a similar pattern in my code and I use this declaration, which works
in CW8 and G++:

class some_class
{
    public:
    
    template <class some_type> some_type & getSomething(
        const some_type * _placeholder_ = 0)
    {
        //...
    }
};

-- grafik - Don't Assume Anything
-- rrivera_at_[hidden] - grafik_at_[hidden]
-- 102708583_at_icq - Grafik666_at_AIM - Grafik_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk