Crow:基于req.rul查找路由Rule对象及匹配参数

Crow::run()会调用Crow::validate(),而后者会调用router_.validate();

void validate()
{
    //Take all the routes from the registered blueprints and add them to `all_rules_` to be processed.
    detail::middleware_indices blueprint_mw;
    validate_bp(blueprints_, blueprint_mw);

    for (auto& rule : all_rules_)
    {
        if (rule)
        {
            auto upgraded = rule->upgrade();
            if (upgraded)
                rule = std::move(upgraded);
            rule->validate();
            internal_add_rule_object(rule->rule(), rule.get(), INVALID_BP_ID, blueprints_);
        }
    }
    for (auto& per_method : per_methods_)
    {
        per_method.trie.validate();
    }
}

1.Crow:黑魔法 添加路由3 绑定lambda-CSDN博客

  解释了

你可能感兴趣的:(C/C++,c++)