Boost logo

Boost :

Subject: Re: [boost] [program_options] Some methods take const char*, others take std::string
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-08-15 12:44:33


On Thu, Aug 11, 2011 at 10:45 AM, Yakov Galka <ybungalobill_at_[hidden]> wrote:
> class str_ref : public iterator_range<const char*> { ... };
>
> Convertible from both, string literals and std::strings, and provide only
> one overload that accepts it everywhere.

Doesn't iterator_range treat literals as arrays by default?
The str_ref idea is great, but IMO iterator_range isn't suitable for it.
Also, doesn't iterator_range require memory allocations itself?

Olaf


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