Boost logo

Boost :

From: Mark Rodgers (mark.rodgers_at_[hidden])
Date: 2000-06-23 06:33:42

From: Moore, Paul <paul.moore_at_[hidden]>
> This version has
> // Absolute value
> friend rational<int_type> abs(const rational<int_type> &r)
> { ... }
> defined inside the class. 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.

It is actually valid to define a friend within a class, but on looking it
up, I see that it is only valid if the function has namespace scope

So to define

  rational<int_type> ::abs(const rational<int_type> &r)

in such a way would have been valid, but to define

  rational<int_type> boost::abs(const rational<int_type> &r)

as I was trying to do would seem to be invalid. :-(

However, as you noted, the issues were to do with the friendship, (Borland
saw the friend declaration and the later definition as two separate
functions, and thus gave me a linker error).

Anyway, I've downloaded your version from the vault and it works fine with
both BCB4 and BCC5.5 (with the operators.hpp that's also sitting in the
vault). Accordingly I've deleted my version.


Boost list run by bdawes at, gregod at, cpdaniel at, john at