测试reference_wrapper

C++标准库bind用法示例
#include <iostream>
#include <functional>
void add(int a, int b, int &r) {
    r = a + b;
}
int main() {
    int r = 0;
    auto f = std::bind(add, std::placeholders::_1, 20, std::reference_wrapper<decltype(r)>(r));
    f(10);
    std::cout << r << std::endl;

    return 0;
}

 

ubuntu@ubuntu-virtual-machine:~/GrabDetect/build$ gdb ./GrabDetect GNU gdb (Ubuntu 10.2-0ubuntu1~18.04~2) 10.2 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./GrabDetect... (No debugging symbols found in ./GrabDetect) (gdb) run Starting program: /home/ubuntu/GrabDetect/build/GrabDetect [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Step into main CUDA可用: 否 未找到CUDA设备,使用CPU模式 OpenCV未启用CUDA支持(可能编译时未开启WITH_CUDA) 配置文件里的模型路径 = [grab.onnx] 配置参数 - SizeImage: 640, Confidence: 0.25, NMS: 0.25 模型路径: [grab.onnx] 使用CPU后端进行推理 files ./data//111.pcap Pcap = ./data//111.pcap [New Thread 0x7fffdf322700 (LWP 3566)] ============= step into ReadPacp ============= [New Thread 0x7fffdeb21700 (LWP 3567)] [New Thread 0x7fffde320700 (LWP 3568)] [New Thread 0x7fffddb1f700 (LWP 3569)] RealtimeThread 开始执行 [New Thread 0x7fffe32e2700 (LWP 3570)] [New Thread 0x7fffdd31e700 (LWP 3571)] [New Thread 0x7fffdcb1d700 (LWP 3572)] [New Thread 0x7fffdc31c700 (LWP 3573)] Thread 5 "GrabDetect" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffddb1f700 (LWP 3569)] 0x0000000000000003 in ?? () (gdb) where #0 0x0000000000000003 in ?? () #1 0x00007ffff76c6233 in cv::dnn::dnn4_v20231225::Net::Impl::clear() () from /usr/local/lib/libopencv_dnn.so.409 #2 0x00007ffff76dd3c9 in cv::dnn::dnn4_v20231225::Net::Impl::setUpNet(std::vector<cv::dnn::dnn4_v20231225::detail::LayerPin, std::allocator<cv::dnn::dnn4_v20231225::detail::LayerPin> > const&) () from /usr/local/lib/libopencv_dnn.so.409 #3 0x00007ffff76de886 in cv::dnn::dnn4_v20231225::Net::Impl::forward(cv::_OutputArray const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) () from /usr/local/lib/libopencv_dnn.so.409 #4 0x00007ffff76be689 in cv::dnn::dnn4_v20231225::Net::forward(cv::_OutputArray const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) () from /usr/local/lib/libopencv_dnn.so.409 #5 0x000055555556d636 in check_Point::detect(cv::Mat const&, cv::dnn::dnn4_v20231225::Net&) () #6 0x000055555556bc46 in check_Point::point_dectect(pcl::PointCloud<pcl::PointXYZRGB> const&, check_Point::Three_Views_Group) () #7 0x000055555556e4ea in check_Grabs::find_Grabs(pcl::PointCloud<pcl::PointXYZRGB> const&, Vector3D const&) () #8 0x00005555555c83f7 in MainRealtime(std::vector<pcl::PointXYZRGB, std::allocator<pcl::PointXYZRGB> >, check_Grabs&) () #9 0x00005555555eb3bc in RealtimeThread(check_Grabs&) () #10 0x00005555555e4152 in void std::__invoke_impl<void, void (*)(check_Grabs&), std::reference_wrapper<check_Grabs> >(std::__invoke_other, void (*&&)(check_Grabs&), std::reference_wrapper<check_Grabs>&&) () #11 0x00005555555e406e in std::__invoke_result<void (*)(check_Grabs&), std::reference_wrapper<check_Grabs> >::type std::__invoke<void (*)(check_Grabs&), std::reference_wrapper<check_Grabs> >(void (*&&)(check_Grabs&), std::reference_wrapper<check_Grabs>&&) () #12 0x00005555555e3fb1 in void std::thread::_Invoker<std::tuple<void (*)(check_Grabs&), std::reference_wrapper<check_Grabs> > >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) () #13 0x00005555555e3f52 in std::thread::_Invoker<std::tuple<void (*)(check_Grabs&), std::reference_wrapper<check_Grabs> > >::operator()() () #14 0x00005555555e3f16 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(check_Grabs&), std::reference_wrapper<check_Grabs> > > >::_M_run() () #15 0x00007ffff137b67f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #16 0x00007ffff37d96db in start_thread (arg=0x7fffddb1f700) at pthread_create.c:463 #17 0x00007ffff0a0a61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
最新发布
11-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值