Boost logo

Boost :

Subject: Re: [boost] SafeInt code proposal
From: Jean-Francois Bastien (jfbastien_at_[hidden])
Date: 2009-06-23 09:03:25


> >> I don't think that non-template friends should be defined inline in
a
> >> class template because they are always supposed to be instantiated
> >> regardless of whether they are used or not (unlike ordinary
members).

[snip]

> Sorry. I reacted automatically, because of the problems that
> I've had with inline friends. In this case, I think it's not
> a problem to define them inline.

[pedanticism]

Don't both your examples rely on pre-standard C++ friend declarations
and definitions injecting the function name in the innermost enclosing
namespace? I might be reading this worng, but 7.3.1.2 [namespace.memdef]
paragraph 3 states: "The name of the friend is not found by unqualified
lookup (3.4.1) or by qualified lookup (3.4.3) until a matching
declaration is provided in that namespace scope".
So you'd still need to declare in the namespace. From what I understand
the examples shouldn't work.

Correct me if I'm wrong :)

JF


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