Boost logo

Boost Users :

From: Jens Seidel (jensseidel_at_[hidden])
Date: 2008-05-03 09:25:12


On Fri, May 02, 2008 at 02:54:19PM -0500, Robert Dailey wrote:
> I'm having a bit of trouble getting user-defined objects working with
> Boost.Test. I skimmed through the docs and I didn't see anything on this
> subject, but the boost documentation isn't the most intuitive documentation,
> so it is a bit easy to miss obvious stuff like this.

Hopefully you read the current docs, the one on www.boost.org is
outdated but not yet replaced.

> Anyway, I have a class named "Foo", and I've given it an overloaded boolean
> == operator. When I do the following, it fails to compile under MSVC9:
>
> The class is defined as follows:
>
> class Foo
> {
> bool operator== ( Foo const& operand )

You should make this operator a const one. This isn't your problem but
...

     bool operator== ( Foo const& operand ) const
> {
> return data == operand.data;
> }
> };

Jens


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