Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个libconfig::config对象,我可以readFile像这样多次:
libconfig::config
readFile
libconfig::Config cfg; cfg.readFiles("./a.cfg"); cfg.readFiles("./b.cfg");
a.cfg如果并且b.cfg有相同的密钥会发生什么?
a.cfg
b.cfg
如果这不起作用,是否有任何方法可以让我将两个配置文件的设置合并到一个对象中?
起初,除非我检查不正确的库,否则该方法似乎readFile()不是。readFiles()
readFile()
readFiles()
其次,每次readFile()调用,config中的值都会被重置。因此,cfg.readFiles("./b.cfg");您将不再进行a.cfg配置。
cfg.readFiles("./b.cfg");