草庐IT

mapped_type

全部标签

c++ - 错误 C2893 : Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...) noexcept(<expr>)'

下面是一个给出编译时错误的程序。这主要与D类中的Boo函数有关。我最终尝试使用多个线程来调用solve方法,但目前这对我来说似乎不太有效,无法做到这一点。错误是:1>d:\dummy\project1\trash.cpp(37):warningC4101:'d':unreferencedlocalvariable1>c:\programfiles(x86)\microsoftvisualstudio\2017\community1\vc\tools\msvc\14.11.25503\include\thr\xthread(240):errorC2672:'std::invoke':no

c++ - std::vector 应该尊重 alignof(value_type) 吗?

如果我定义一个具有特定对齐要求的简单类型,该类型的std::vector难道不应该为每个元素遵守对齐吗?考虑下面的例子typedefstd::arrayalignas(32)avx_point;std::vectorx(10);assert(!(std::ptrdiff_t(&(x[0]))&31)&&//assertthatx[0]is32-bytealigned!(std::ptrdiff_t(&(x[1]))&31));//assertthatx[1]is32-bytealigned我发现clang3.2(带或不带-stdlib=libc++)悄悄地(没有任何警告)违反了对齐要求

c++ - 振奋 spirit : What type names should be used for the built in terminals?

我正在重构一个类型系统(类型模型),它使用spirit进行字符串序列化。我正在使用类型特征的编译时建模构造。templatetype_traits{typedefboost::spirit::qi::int_parserstring_parser;}templatetype_traits{typedefboost::spirit::ascii::stringstring_parser;}在这个例子中,我展示了原始解析器,但我希望也加入规则。int4类型有效,但这是因为(home/qi/numeric/int.hpp+27):namespacetag{templatestructint_

map - C++ wcout std::map 值

我有一个名为“提示”的std::map,声明如下:std::map,std::allocator>>prompts;它存储int'key'和wstring'value'对。如果我这样做:wcoutget_state()];编译器(vc10)提示errorC2679:binary''(orthereisnoacceptableconversion)我必须做什么才能使map返回的wstring值用wcout打印?某种类型转换?或者……? 最佳答案 在第一行中,您缺少一个std::std::mapstd::wstring,std::les

c++ - 如何使用 std::map 在 C++ 中构建树结构

我正在尝试用C++编写一种树状结构。就像每棵树都有Twig和树叶一样。一个分支可以包含其他分支以及叶子。现在我的实现要求每个分支和叶子具有不同的功能。例如。走树状结构Root||Branch1Branch2Branch3|||Leaf1Leaf2Branch4NowEachLeafandbranchhasadifferentfunctiontoexecutesoLeaf1willhaveafunctioncalledleaf1_func,Leaf2willhaveleaf2_func,Branch4hasBranch4_func.我最初尝试实现复合设计模式。但这意味着我将拥有与叶子一样

【完美解决】Python 中 pyecharts 的Map地图数据不显示问题

问题背景:在使用pyecharts的map中国地图当中,数据结构已经构成,但是运行时候之后数据并没有显示出来,如下图:  原因分析:新版pyecharts的map中国地图,省份参数需要加上"省“,例如:“安徽”,就必须要是安徽省,这样数据才能在地图中显示问题解决首先定义一个方法,我这边起名province,然后在方法中定义出一个含有中国34个省自治区的全称的列表,使用for循环遍历所有的列表中的省份,依次判断传入的参数是否包含在列表元素中,如果包含,则返回对应的列表元素,我这里用了两个方法,一个是find函数,一个是in函数defprovince(pro):provinces=["北京市","

c++ - C : x86 Intel Intrinsics usage of _mm_log2_ps() -> error: incompatible type 'int' ?

我正在尝试将log2应用于__m128变量。像这样:#includeintmain(void){__m128two_v={2.0,2.0,2.0,2.0};__m128log2_v=_mm_log2_ps(two_v);//log_2:=log(2)return0;}尝试编译会返回此错误:error:initializing'__m128'withanexpressionofincompatibletype'int'__m128log2_v=_mm_log2_ps(two_v);//log_2:=log(2)^~~~~~~~~~~~~~~~~~~我该如何解决?

c++ - 使用 BOOST::associative property map 插入 boost::BIMAP ... 失败

引用我之前提出的关于boost::bimaps和boostassociativepropertymaps接口(interface)的问题here,我想为我的bimap使用Put和Get辅助函数。引用给出的示例代码here,我尝试添加以下内容,但由于断言失败而出现很长的编译错误...这是代码:#include#include#include#includeusingnamespaceboost;intmain(){typedefintvertex_descriptor_t;typedefboost::bimaps::bimapvd_idx_bimap_t;typedefboost::as

python - c++中python "type(<name>, <bases>, <dict>)"的等价物是什么?

好吧,我正在将python3.3嵌入到C++应用程序中。我希望在C++端动态创建一个Python类,就像我在Python中执行以下操作一样:my_type=type("MyType",(object,),dict())我知道我总是可以导入“builtins”模块,但我一般会尽量避免在C++端导入。谢谢! 最佳答案 以下似乎工作得很好:PyObject*type(constchar*name,boost::python::tuplebases,boost::python::dictdict){returnPyType_Type.tp_

c++ - 如何将数据类型的 std::map 制作为函数指针

我有这样的数据结构enumDataType_t{INT,FLOAT};structData{DataType_Ttype;void*min;void*max;};变量min和max取决于type的值。我想知道是否有办法创建std::map之类的std::mapmyMap;myMap[INT]=??//Hereshouldbeapointertoafunctionlikeint(*FcnPtr)(Datad,boolmin);myMap[FLOAT]=??//Hereshouldbeapointertoafunctionlikefloat(*FcnPtr)(Datad,boolmin);