How to do code factoring when using Boost.Program_options?

Hi, Suppose that I have program option set U. I have many programs which uses a subset of U as their options. Some of them share the same subset. For now, I code all the options in the main function like the one in the tutorial http://www.boost.org/doc/html/program_options/tutorial.html However, there is a problem when I have a lot programs with similar options. I would like to factor out the common code. But I don't have an idea how to do it in a good way. If you happen to have some experience, please let me know and share your experience with me. Thanks, Peng

Peng Yu escreveu:
Hi,
Suppose that I have program option set U. I have many programs which uses a subset of U as their options.
Some of them share the same subset. For now, I code all the options in the main function like the one in the tutorial http://www.boost.org/doc/html/program_options/tutorial.html
However, there is a problem when I have a lot programs with similar options. I would like to factor out the common code. But I don't have an idea how to do it in a good way.
I think the "Multiple Sources" section of the tutorial describes what you want. -- Pedro Lamarão

Suppose that I have program option set U. I have many programs which uses a subset of U as their options.
Some of them share the same subset. For now, I code all the options in the main function like the one in the tutorial http://www.boost.org/doc/html/program_options/tutorial.html
However, there is a problem when I have a lot programs with similar options. I would like to factor out the common code. But I don't have an idea how to do it in a good way.
I think the "Multiple Sources" section of the tutorial describes what you want.
I did read that section before posting this question. I don't see how it describes what I want. Would you please elaborate on that? Thanks, Peng
participants (2)
-
Pedro Lamarão
-
Peng Yu