Boost logo

Boost Users :

Subject: Re: [Boost-users] Program Options not saving the values
From: Angelo Mondaini (oangelo_at_[hidden])
Date: 2014-07-02 10:04:54


Indeed, thanks!

2014-07-02 4:13 GMT-03:00 Vladimir Prus <ghost_at_[hidden]>:

> On 07/02/2014 02:02 AM, Angelo Mondaini wrote:
>
> Hi Angelo,
>
>
> std::cout << "var: " << add << std::endl;
>> std::cout << "vm: " << vm["add"].as<int>() << std::endl;
>> po::notify(vm);
>>
>> return 1;
>> }
>>
>> Compiling and running:
>> $ g++ program_options.cpp -lboost_program_options
>> $ ./a.out --add 4
>> var: 5
>> vm: 4
>>
>> Why the value of the variable "add" is not receiving 4?
>>
>
> Because 'add' is only assigned when you call po::notify, and your program
> prints the value
> of 'add' before calling po::notify
>
> - Volodya
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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