Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2002-11-01 18:47:57


Right, but then, how do you call it:

object.getSomething<type>();
or
object.getSomething((type*)0);

I wasn't able to use the first syntax, although I was able to do similar
things with non-member functions.

Arkadiy

"Rene Rivera" <grafik666_at_[hidden]> wrote in message
news:20021101171555-r01010800-6478d435-0860-0108_at_12.100.89.43...
> [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]
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


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