今天在开发程序时遇到了一个bug,花了好久的时间终于调好了。特此记录一下,方便日后查看,也希望对在此处有困惑或者遇到类似bug的朋友有所帮助。
程序的片段如下:
std::vector<LaneInfoConstPtr> lane_ptrs;
228 _map_cache->get_all_lanes(&lane_ptrs);
229 for (const auto& lane_ptr : lane_ptrs) {
230 lane_ptr->post_process(*this);
231 }
LaneInfoConstPtr是shared_ptr<const LaneInfo>
类型。所以,lane_ptrs中存储的是指向const 对象的指针。而post_process
是L