Boost logo

Boost Users :

Subject: Re: [Boost-users] how to compare fusion adapted structures
From: Olaf Peter (ope-devel_at_[hidden])
Date: 2010-05-07 01:53:25


Agustín K-ballo Bergé schrieb:
> El 06/05/2010 02:04 p.m., Olaf Peter escribió:
>> bool operator==( const foo& lhs, const foo& rhs )
>> {
>> return lhs == rhs;
>> }
>
> Unless I'm missing something, this looks like infinite recursion, which
> would cause stack overflow. Don't you get a warning from your compiler?

yes, that is it (over right I came to the same result). Here, this works:

bool operator==( const foo& lhs, const foo& rhs )
{
    return fusion::equal_to( lhs, rhs );
}

fusion::operator==( lhs, rhs ) won't compile

fusion_tie.cpp: In function ‘bool operator==(const<unnamed>::foo&,
const<unnamed>::foo&)’:
fusion_tie.cpp:18: error: no matching function for call to
‘operator==(const<unnamed>::foo&, const<unnamed>::foo&)’

I've got no warning from gcc version 4.4.1 (no extra Warning option).

Thanks,
Olaf


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