Crow:蓝图路由1 CROW_BP_ROUTE-CSDN博客
介绍了蓝图路由主要的一个作用就是将路由划分成蓝图路由根目录,然后再在蓝图路由创建子路由。
蓝图路由其实还可以在其下注册新的子蓝图路由,从而实现子目录的继续划分:
crow::Blueprint bp("bp_prefix", "cstat", "ctemplate");
crow::Blueprint sub_bp("bp2", "csstat", "cstemplate");
bp.register_blueprint(sub_bp);
可以看到在bp在其下又注册了子蓝图sub_bp
下面解释一下这部分的实现
class Blueprint
{
public:
...
void register_blueprint(Blueprint& blueprint)
{
if (blueprints_.empty() || std::find(blueprints_.begin(), blueprints_.end(), &blueprint) == blueprints_.end())
{