参考网址:
(112条消息) make_pair函数_半尺杆头的博客-CSDN博客_make_pair
(112条消息) C++STL中vector容器 assign()函数的用法_xlm289348的专栏-CSDN博客_vector的assign函数
代码演示
make_pair()
1 2 3 4 5
| return std::make_pair(int, float); std::pair<int, float> result {loop_id, yaw_diff_rad}; std::pair<float, int> sc_dist_result = distanceBetweenScancontexts( curr_desc, context_candidate ); float candidate_dist = sc_dist_result.first; int candidate_align = sc_dist_result.second;
|
mean()
1 2 3 4 5
| mean()求均值 mean(A) 若A为[矩阵](https://so.csdn.net/so/search?q=矩阵&spm=1001.2101.3001.7020),则输出每一列的均值(一个向量) 若A为列向量,则输出均值(一个数) 若A为行向量,则也是输出均值(一个数),和列向量一样
|
代码
1 2 3 4 5 6 7
| Eigen::MatrixXf invariant_key(desc.rows(), 1); for ( int row_idx = 0; row_idx < desc.rows(); row_idx++ ){ Eigen::MatrixXf curr_row = desc.row(row_idx); invariant_key(row_idx, 0) = curr_row.mean(); }
|
assign()
1 2
| void assign(const_iterator first,const_iterator last);
|
1 2
| v2.assign(v1.begin(), v1.end()-6);
|