Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a compile error on g++ regarding const comparison functors in config parser #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conffile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void ConfigFile::ClearLines()
}
}

bool ConfigFile::ConfigEntry::section_then_key_less::operator()(const ConfigEntry &a, const ConfigEntry &b) {
bool ConfigFile::ConfigEntry::section_then_key_less::operator()(const ConfigEntry &a, const ConfigEntry &b) const {
if(curConfigFile && a.section!=b.section){
const int sva = curConfigFile->GetSectionSize(a.section);
const int svb = curConfigFile->GetSectionSize(b.section);
Expand Down
4 changes: 2 additions & 2 deletions conffile.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ConfigFile {
mutable bool used;

struct section_then_key_less {
bool operator()(const ConfigEntry &a, const ConfigEntry &b);
bool operator()(const ConfigEntry &a, const ConfigEntry &b) const;
};

struct key_less {
Expand All @@ -101,7 +101,7 @@ class ConfigFile {
};

struct line_less {
bool operator()(const ConfigEntry &a, const ConfigEntry &b){
bool operator()(const ConfigEntry &a, const ConfigEntry &b) const {
if(a.line==b.line) return (b.val.empty() && !a.val.empty()) || a.key<b.key;
if(b.line<0) return true;
if(a.line<0) return false;
Expand Down