Boost logo

Boost :

Subject: Re: [boost] [program_options] Some methods take const char*, others take std::string
From: Gabriel Redner (gredner_at_[hidden])
Date: 2011-08-14 18:45:54


On Thu, Aug 11, 2011 at 4:45 AM, Yakov Galka <ybungalobill_at_[hidden]> wrote:
> Another option is to define
>
> 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.
>
> Just an idea.
> --
> Yakov

Hi Yakov,

Thanks for your suggestion! In the end though, I decided to add
separate std::string overloads. Since the interfaces involved are few
and simple, it seemed better to overload in the most straightforward
way, rather than add something fancier just to save a bit of typing on
the implementation side.

Thanks,
-Gabe


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