草庐IT

mapped_type

全部标签

c++ - 将 QComboBox::currentIndexChanged(int) 连接到 QSignalMapper::map()

我想弄清楚如何在Qt5中实现这一点:connect(qcombobox,SIGNAL(currentIndexChanged(int),qsignalmappe,SLOT(map()));我试过这个:connect(comboBox,static_castsignalMapper,&QSignalMapper::map);但是编译器提示没有匹配的参数。我知道QSignalMapper::map()信号没有参数,但我不知道它如何使用旧语法。 最佳答案 试试这个,它对我有用connect(comboBox,static_cast(&QC

c++ - 使用 Eigen::Map<Eigen::MatrixXd> 作为 Eigen::MatrixXd 类型的函数参数

简而言之,问题是如何通过一个Eigen::Map反对一个期待一个函数Eigen::MatrixXd对象。长话短说:我有这个C++函数声明voidnpMatrix(constEigen::MatrixXd&data,Eigen::MatrixXd&result);连同这个实现voidnpMatrix(constEigen::MatrixXd&data,Eigen::MatrixXd&result){//Justdos.th.withargumentsstd::cout我想使用numpy.array作为参数从python调用这个函数。为此,我使用了一个用c++编写的包装器函数voidpyM

c++ - 我们能否在运行时确定两个 type_info 是否可转换?

有没有办法从两个const::std::type_info中判断对象,让我们将它们命名为B和D如果D描述的类型是从类型B派生的?我问是因为我想删除我得到的对象的类型,但稍后能够检查它是否可以安全地提升。void*data;const::std::type_info*D;templatevoidstore(D&&object){D=&typeid(object);data=::std::addressof(object);}templateB&load(){//if(typeid(B)!=(*D))throw::std::bad_cast{};return*reinterpret_cas

c++ - 如何将 boost::iostreams::mapped_file_source 与 gzip 压缩的输入文件一起使用

我正在使用boost::iostreams::mapped_file_source将文本文件从特定位置读取到特定位置并操作每一行(使用g++-Wall-O3-lboost_iostreams-otestmain.cpp编译):#include#include#includeintmain(){boost::iostreams::mapped_file_sourcef_read;f_read.open("in.txt");longlongintalignment_offset(0);//setthestartpointconstchar*pt_current(f_read.data()+

c++ - 通过 std::tuple<...> 实现 map() 和 each() - 将索引作为模板参数传递给仿函数

经过几年的Web开发,我再次使用C++(14)工作,并决定通过模板元编程获得一些“动态类型函数的乐趣”。我已经实现了map和each在元组上:templatevoidtuple_each_internal(Tupleconst&tuple,Funcfunc,index_sequence){autores={(func(get(tuple)),nullptr)...};}template::value>>voidtuple_each(Tupleconst&tuple,Funcfunc){tuple_each_internal(tuple,func,Indices());}structde

c++ - 合并多个 map

我已经在boost邮件列表中询问过这个问题,但我似乎并不清楚自己的意图。也可能是我没有完全理解如何才能做到这一点。我想在hana中合并多个map,看下面的代码示例:constexprautom1=hana::make_map(hana::make_pair("key1"_s,hana::type_c),hana::make_pair("key2"_s,hana::type_c));constexprautom2=hana::make_map(hana::make_pair("key3"_s,hana::type_c),hana::make_pair("key4"_s,hana::typ

c++ - 错误 : incomplete type when using HMAC_CTX in C++ project

我正在尝试编译这个库ndn-cxx在我的笔记本电脑里。我已经在另一台计算机上尝试过并且编译成功但现在我收到此错误并且我认为它与openssl相关。我使用sudoapt-cachesearchlibssl|确认我的笔记本电脑中有openssl|grepSSL结果是:libssl-ocaml-OpenSSL的OCaml绑定(bind)(运行时)libssl-ocaml-dev-OpenSSL的OCaml绑定(bind)libssl0.9.8-SSL共享库libsslcommon2-企业消息传递系统-通用SSL库libsslcommon2-dev-企业消息系统-通用SSL开发文件我在尝试编译

Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String

ErrorstartingApplicationContext.Todisplaytheconditionevaluationreportre-runyourapplicationwith'debug'enabled.2024-01-05T17:04:00.527+08:00ERROR201118---[solve][main]o.s.boot.SpringApplication:Applicationrunfailedjava.lang.IllegalArgumentException:Invalidvaluetypeforattribute'factoryBeanObjectType':j

c++ - 继承类中的 shared_from_this() 类型错误(是否有 dyn.type-aware 共享指针?)

我有一个使用enable_shared_from_this的ViewController基类classViewController:publicstd::enable_shared_from_this{//...};和一个child:classGalleryViewController:publicViewController{voidupdateGallery(floatdelta);}问题出现了,当我尝试将我当前的实例传递给第3方时(比如lambda函数被安排在某处)实例(GalleryViewController)会释放一个(罕见的)条件,所以我不能直接捕获“this”,我需要用

c++ - auto const & map 迭代器的类型是什么? C++

我需要修复我的旧项目中的一些错误,我认为这是重构部分代码的最佳时机。我有一个具有以下结构的map:std::map>ComponentMap;在我需要遍历一些底层子map的某个地方,我使用了以下内容:for(std::map::iteratoriter=ComponentMap[compNameString].begin();iter!=ComponentMap[compNameString].end();++iter){//somecodeif(IsComponentOfType(iter,sCOMP_PRINCIPAL))iter->second->GetComponentValu