从新源重新加载 boost::program_options 中的选项值
我刚刚开始第一次深入研究 boost::program_options
。我非常喜欢它。然而,我试图用它完成的事情似乎并不是它的设计者所考虑的。
我想使用 boost::program_options 来解析命令行选项和配置文件。到目前为止,一切都很好。此外,我希望能够检查更新的设置(例如从新的配置文件中),这些设置可以覆盖变量映射中先前解析的设置。
当然,我可以进行单独的解析并尝试合并两个映射。也许这就是我最终要做的事情。不过,我只是想知道是否有人以前做过类似的事情并提出了一个巧妙的解决方案。
I'm just starting to dig into boost::program_options
for the first time. I like it quite a bit. However, what I'm trying to accomplish with it doesn't seem to be something its designers have accounted for.
I want to use boost::program_options
to parse both command line options as well as config files. So far so good. Additionally, though, I would like to be able to check for updated settings (say from a new config file) that could override the previously parsed settings in my variables_map.
Granted, I could do a separate parse and try to merge the two maps. Perhaps that's what I'll end up doing. I'm just wondering, though, if anyone has done anything like this before and has come up with a slick solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论