1
0

fix: replace find with contains in constraint builder

- remove useless old files.
This commit is contained in:
2025-08-13 08:51:53 +08:00
parent 8fcfa180b4
commit f65eff6edf
7 changed files with 5 additions and 333 deletions

View File

@ -35,14 +35,10 @@ namespace yycc::constraint::builder {
T default_entry = il.begin()[default_index];
std::set<T> entries(il);
// TODO: modify it as `contain` once we finish patch namespace.
auto fn_check = [entries](const T& val) -> bool { return entries.find(val) != entries.end(); };
auto fn_check = [entries](const T& val) -> bool { return entries.contains(val); };
auto fn_clamp = [entries, default_entry](const T& val) -> T {
if (entries.find(val) != entries.end()) {
return val;
} else {
return default_entry;
}
if (entries.contains(val)) return val;
else return default_entry;
};
return Constraint<T>(std::move(fn_check), fn_clamp);
}

View File

@ -24,7 +24,8 @@ namespace yycc::patch::fopen {
// check convertion success
if (wmode.has_value() && wpath.has_value()) {
// call microsoft specified fopen which support wchar as argument.
// Call MSVCRT specified fopen which support wchar as argument.
// Reference: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-170
return _wfopen(wpath.value().c_str(), wmode.value().c_str());
} else {
// fail to convert encoding