Boost logo

Boost :

Subject: Re: [boost] [range] as_literal always returning iterator_range
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-05-04 04:55:09


Den 03-05-2011 14:22, Tobias Germer skrev:
> Hi all,
>
> I think there is a problem with the behavior of boost::as_literal. If I
> got it right, it is supposed to create an iterator_range from
> null-terminated strings, which is fine. However, it also creates
> iterator_ranges from exisiting ranges, i.e., it converts general ranges
> to iterator_ranges. I think as_literal should fall back to identity
> (i.e., just return its argument) if its argument is already a range.
>
> With the current behavior, the type information of the range is lost.
> This is a problem if I write generic code and want to dispatch several
> cases based on the type of the range. Consider the following example:

I think what you are proposing needs a new name unless we can guarantee
that no code is broken.

-Thorsten


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