Boost logo

Boost :

Subject: Re: [boost] [program_options]
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-03-07 02:53:25


----- Original Message -----
From: "Vladimir Prus" <vladimir_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, March 07, 2010 7:25 AM
Subject: Re: [boost] [program_options]

>
> vicente.botet wrote:
>
>> Hi,
>> ----- Original Message -----
>> From: "Phil Richards" <news_at_[hidden]>
>> To: <boost_at_[hidden]>
>> Sent: Saturday, March 06, 2010 11:59 AM
>> Subject: Re: [boost] [program_options]
>>
>>
>>> Description is even simpler: it just uses the const char* argument as a
>>> parameter to a std::string constructor. Accepting a std::string const&
>>> instead of a const char* will have minimal overheads (possibly one extra
>>> temporary string creation).
>>>
>>> But maybe I'm missing something obvious?
>>
>> The fact that currently the implementation use a temporary string doesn't means that we can not
>> change the implementation. The interface with a string const reference involves already an
>> allocation and deallocation when you have a const char*.
>>
>> What about having both overloads? const char * is the best for literals, while string cont& is the
>> best for strings variables.
>>
>> void option_description::set_name(string const&_name);
>> void option_description::set_name(const char* _name);
>
> As I've said already, I don't remember why this is not provided, and will have to think about
> it.

Apologize,

I have not read the complete thread.

Best,
Vicente


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