Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6362259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:53:09+00:00 2026-05-24T23:53:09+00:00

This question is about the C++ Boost program_options library. All the tutorials are very

  • 0

This question is about the C++ Boost program_options library.

All the tutorials are very clear that I should call notify() on my completed variable map, but I’m not sure what this is actually doing for me. Commenting it out didn’t seem to have any effect, and the documentation didn’t go into much detail:

http://www.boost.org/doc/libs/1_47_0/doc/html/boost/program_options/notify.html

Other sources suggest that it runs “user-defined” functions. If so, how are those functions registered and what do they do? Might they throw exceptions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:53:10+00:00Added an answer on May 24, 2026 at 11:53 pm

    notify() is a member function of value_semantic. It is a hook that is provided so that, once the final value of an option is determined, any action that should be taken with that option can be done automatically and be encapsulated in its own function. This prevents code from having one long function that acts on each of the options. As the possible options grow, that kind of procedural code can get unwieldy.

    You can see an example of setting a notify function in the Boost manual:

    options_description desc;
    desc.add_options()
        ("compression", value<int>()->default_value(10), "compression level")
        ("email", value< vector<string> >()
            ->composing()->notifier(&your_function), "email")
        ;
    

    These declarations specify that default value of the first option is
    10, that the second option can appear several times and all instances
    should be merged, and that after parsing is done, the library will
    call function &your_function, passing the value of the "email" option
    as argument.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my very first question so I am a bit nervous about it
I was looking at some code that uses Boost.Function and have a question about
I am using the boost library and my question is about boost::signals. I have
This question about Timers for windows services got me thinking: Say I have (and
Followed this question about delayed_job and monit Its working on my development machine. But
This question is a follow up to my previous question about getting the HTML
I was reading this question about how to parse URLs out of web pages
I just came across this question about initializing local variables. Many of the answers
I have seen this question about deploying to WebSphere using the WAS ant tasks.
Follow up to this question about GNU make : I've got a directory, flac

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.