
Boost : 
Subject: Re: [boost] Naming convention of iterated binary operation
From: Rob Stewart (rstewart_at_[hidden])
Date: 20160502 15:19:40
On May 2, 2016 5:30:40 AM EDT, Jeremy Murphy <jeremy.william.murphy_at_[hidden]> wrote:
>On 2 May 2016 at 18:20, Rob Stewart <rstewart_at_[hidden]> wrote:
>> On May 1, 2016 11:25:39 PM EDT, Jeremy Murphy < jeremy.william.murphy_at_[hidden]> wrote:
>> >
>> >For example, Boost.Functional/Hash has an iterated hash() called
>> >hash_range(). I don't mind the "_range" suffix but I prefer the
>> >"iterated_"
>> >prefix based on the mathematical definition:
>> >https://en.wikipedia.org/wiki/Iterated_binary_operation
>> >
>> >The case in point is gcd() in Boost.Math: we want to provide an
>> >iterated gcd but we can't quite decide how to name it. I like the
>> >"iterated_" prefix but I would rather go with whatever might be
>> >the convention.
>
>In C++, given overloading, it isn't necessary to use a different name
>> for different arguments. Therefore, I wonder whether "gcd" is
>> sufficient for the iterated case.
>
>Indeed, this is an interesting point and I thought about it for some
>time
>already. My (strong) feeling is that functions with different semantics
>should have different names, but I don't have a formal or strong
>argument
>to support this. I know we can use the same name but it doesn't seem
>like a
>good idea apart from minimizing the number of names in a namespace.
>
>A variadic template version with the same name makes sense to me,
>though.
There's some detail missing. How is your iterated GCD function different from a variadic gcd()?
___
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