Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2006-01-04 07:11:32


Peder Holt wrote:
> On 1/3/06, Alexander Nasonov <alnsn_at_[hidden]> wrote:
>>The patch below fixes this problem.
>>It's built around comma operator:
>>
>>struct void_ {};
>>template<class T> T& operator,(T const&, void_);
>
>
> How will this work if someone implements their own operator,?
> template<class T> T& operator,(const my_type&,const T&);
>
> if expr equals my_type, wouldn't this break typeof for my_type?

You're right. I should have added a special object to the left of expr:

( wrap_nonvoid_expr(), (expr), resolve_void() ).get()

template<class T>
struct wrapped_obj
{
     T& get();
};

struct wrap_nonvoid_expr
{
     template<class T>
     wrapped_obj<T> operator,(T const&);
};

struct resolve_void
{
     void get();
};

template<class T>
wrapped_obj<T> operator,(wrapped_obj<T>, resolve_void);

-- 
Alexander Nasonov

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