这是我最近在 VS2012 中编写的一些代码:
///<summary>Lambda: Returns true if the field is significant within a baseline context</summary>
const auto IsSignificantBaselineField = [](const field_info & field)->bool
{
//Some lines removed here!
return something;
};
///<summary>Lambda: Returns true if the field is significant within a project context</summary>
const auto IsSignificantProjectField = [&IsSignificantBaselineField](const field_info & field)->bool
{
if (!IsSignificantBaselineField (field))
return false;
//Some lines removed here!
return something_else;
};
return std::any_of (modified_fields.begin (), modified_fields.end (), (proj_id == 0) ? IsSignificantProjectField : IsSignificantBaselineField);
奇怪的是,当“proj_id = 90000”时,std::any_of 正在调用 IsSignificantProjectField,而我的意图是在这种情况下调用 IsSignificantBaselineField。
请任何人都可以解释我的逻辑中的错误吗?