3
我正在使用opencv讀取和寫入我的應用程序配置文件。 我有一個布爾,我想在那裏存儲。它它保存爲一個int:OpenCV YAML解析bool
相機: auto_gain:1
我嘗試閱讀下列方式:
auto_gain=static_cast<bool>(static_cast<int>(camera["auto_gain"]));
但我得到一個警告:
警告C4800:'int':將值強制爲bool'true'或 'false'(性能警告)
在這種情況下解析bool的正確方法是什麼?