Boost logo

Boost :

Subject: Re: [boost] Naming convention of iterated binary operation
From: Rob Stewart (rstewart_at_[hidden])
Date: 2016-05-03 09:47:34


On May 3, 2016 1:37:22 AM EDT, Jeremy Murphy <jeremy.william.murphy_at_[hidden]> wrote:
>
>Variadic gcd takes n things of type T and returns a T:
>
>f(T, ..., T) -> T
>
>whereas "iterated" gcd takes a thing (Range) or things (iterators) that
>denote a range of Ts:
>
>g(U) -> T
>g(U, U) -> T
>
>So yes, in the implementation, variadic gcd is an iterated binary
>operation
>(with special case of n=1).
>But the semantics are different because of how the input is
>interpreted,
>which for me is sufficient reason to give them different names.
>
>So it's probably more accurate that I say it's gcd over an iterator
>range
>that I think should have a different name to 'plain' gcd (which is
>iterated
>in a variadic version).
>Which makes the "_range" suffix all the more sensible.

I see the range-based variants as obvious, without special naming, because the only logical semantic is to iterate the range of values. If adding a modifier helps with overloading, then I do like the "_range" suffix far more than your "iterated_" prefix, FWIW.

___
Rob

(Sent from my portable computation engine)


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