|
Boost : |
Subject: Re: [boost] [static_if] Is there interest in a `static if` emulation library?
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2014-09-03 12:54:14
On 03/09/2014 01:39 p.m., Robert Ramey wrote:
> So far I haven't seen anyone propose an example which benefits from the
> original proposal. Seems to me a solution to a non-existent problem.
Purely pseudocode, but I believe the intention of the proposal is to be
able to do things like:
template< class InputIt, class Distance >
void advance( InputIt& it, Distance n )
{
static_if(is_random_access_iterator<InputIt>()) { it +=n; }
static_else { /*increment/decrement it in a loop*/ }
}
...without having to resort to SFINAE-d overloads nor tag dispatching,
given that `it += n` is not required to compile for iterators whose
category is weaker than random access.
Regards,
-- Agustín K-ballo Bergé.- http://talesofcpp.fusionfenix.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk