|
Boost : |
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2023-10-11 18:29:49
On 11/10/2023 19:02, Richard Hodges via Boost wrote:
>> If I were designing that API, I'd personally provide a user supplied
>> callable which gets invoked to decide on the tie break, and I'd default
>> its implementation to one choosing randomly. Then users can choose
>> whatever suits them, and no need for left_xxx() functions etc.
>
> This is probably why itâs best I stick to hacking together trading systems.
>
> Wouldnât it be difficult to default the argument to prefer_left() or similar though, given that the parameters are a variadic pack of sources?
>
> Not having a default would be unacceptable to me as it would involve:
> - more typing, and
> - having to read the documentation prior to hacking the code together.
I guess it depends on what you're used to, but in principle I have no
idea with convenience wrapper functions which save obtuse syntax for a
base implementation function.
You can design APIs to take variadic packs of variadic packs if you
want. I actually have an API like that in my work code base, I couldn't
think of anything less worse, so I went with it.
Niall
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk