From: David Abrahams (abrahams_at_[hidden])
Date: 2000-06-23 06:19:21
From: "Moore, Paul" <paul.moore_at_[hidden]>
> As far as I'm aware, it's not valid to define a
> friend function inline within a class, and even if it is, it breaks MSVC.
> See the standard:
> [9.3.1] Functions declared in the definition of a class, excluding those
> declared with a friend specifier (11.4), are called member functions of
> [9.3.2] A member function may be defined (8.4) in its class definition
> By implication, friends aren't members, and so may not be defined in the
> class definition. [Technically, my logic is not 100% right here, but the
> intent is clear].
As far as I can tell, your logic isn't even a little bit right here. You
seem to have completely misread this part of the standard. The technique is
well-established, and in fact almost everything in operators.hpp (which even
works with MSVC) relies on it. There may be an issue with MSVC and friend
_template_ functions defined within the class body, though.
> Borland (the free command line compiler 5.5) goes boom in operators.hpp. I
> haven't kept up with the recent operators.hpp hacking, so I'll have to
> for a working version before I can do much more.
Go to the vault and try operators.zip. Things have been moving too fast for
me to keep up (as the maintainer), too. That code will probably be official
in a few days, pending my own evaluation and tests.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk