Boost logo

Boost :

Subject: Re: [boost] SafeInt code proposal
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-21 10:12:34


AMDG

Niels Dekker - address until 2010-10-10 wrote:
> Steven Watanabe wrote:
>> It's better to use non-members for operator+, operator-, etc.
>
> In the case of a template class like SafeInt<T>, do you think the
> binary operator+, operator-, etc., should be friend functions, defined
> inside the class declaration, or template functions?

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). For templated operator+,
etc, I don't really
care.

> Note that I've just posted a slightly related ticket on David
> LeBlanc's SafeInt: "Potential performance gain from non-member operator+"
> http://safeint.codeplex.com/WorkItem/View.aspx?WorkItemId=7910
>
> BTW, I do think it would be great to have such a library in Boost.
>
> Kind regards, Niels

In Christ,
Steven Watanabe


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