|
Boost Users : |
From: Steve Byan (smb_at_[hidden])
Date: 2006-01-26 08:42:29
On Jan 26, 2006, at 4:54 AM, Vladimir Prus wrote:
> Simply, the standard says second argument of main is non-const.
> Using const
> version is strictly speaking, invalid,
There are circumstances where one wishes to pass something other than
main()'s raw arguments to parse_command_line(). For example, I've
refactored a suite of test tools to use a simple common command-line
tool framework. In this framework, I save argc and argv as member
variables which are initialized in the constructor of the base class
of the framework. I defer the call to parse_command_line() to a
method called sometime later, after derived classes have the
opportunity to configure their unique options_description.
In this case, it's nice to be able to declare myArgv as const char **
myArgv.
boost::program_options:: doesn't really modify argv, does it?
> and in practice I recall there were
> some problems making both consts and non-const to work.
I can see how it wold be difficult to handle deriving the non-const
type from the template arguments. If it's a trade between being const-
correct and supporting localization, clearly supporting localization
is the way to go.
Regards,
-Steve
--------
Steve Byan <smb_at_[hidden]>
Software Architect
Egenera, Inc.
165 Forest Street
Marlboro, MA 01752
(508) 858-3125
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net