Open
Description
Hi,
I am encountering an issue when working with the mINI::INIStructure
type in a function. Here is the scenario:
I read my .ini
file in main.cpp
as follows:
mINI::INIFile file(config_file);
mINI::INIStructure ini;
if (!file.read(ini)) {
std::cout << "Failed to read config file: " << config_file << "\n";
return 1;
}
Later, I have a function that accepts a mINI::INIStructure
object as a parameter:
void my_func(mINI::INIStructure ini)
Inside this function, I cannot use the []
operator on the ini
parameter. When I try to access the structure like this:
ini["GENERAL"]["work_dir"];
It results in a compilation error. However, using the .get
method works without any issues:
ini.get("GENERAL").get("work_dir");
Compiler Error:
error C2678: binary '[': no operator found which takes a left-hand operand of type 'const mINI::INIStructure' (or there is no acceptable conversion)
My Question:
Is this behavior expected? Or is there something I am doing incorrectly?
Thank you for your help!
Metadata
Metadata
Assignees
Labels
No labels