草庐IT

INPUT_OBJ_TYPE

全部标签

c++ - 我们应该在何时、何地以及为什么使用 "BigObject&& rv = std::move(big_obj);"?

我的编译器是最新的VC++2013预览版。#includestructBigObject{...};voidf(BigObject&&){}voidf(BigObject&){}voidf(BigObject){}intmain(){BigObjectbig_obj;BigObject&r1=big_obj;//OK.BigObject&&r2=big_obj;//errorC2440BigObject&&r3=std::move(big_obj);//OK.BigObject&&r4=r3;//errorC2440f(r3);//errorC2668:'f':ambiguouscal

c++ - 无法在 VS 14 CTP : conditional expression of type 'void' is illegal 中使用 auto 声明 lambda

使用VisualStudio2014CTP、C++(v140)编译器:autogp=[&](BYTE*buff){autogp1=[](char*bff,char**p1){*p1=strstr((char*)bff,"(");return(*p1);};};错误:conditionalexpressionoftype'void'isillegal(也许auto真的输入错误?)如果我将内部lambda声明为std::functiongp1然后就可以了是我做错了什么还是编译器错误? 最佳答案 我没有运行2014,但您可能需要指定内部l

c++ - 使用前向声明时如何修复 "field has incomplete type"错误

如注释中所述,此代码抛出编译器错误error:field‘fTarget’hasincompletetype。为什么会这样?我只是分配那个字段而不做任何需要知道里面是什么的操作......或者我是?也许它无法弄清楚复制构造函数?classFSRVertex;//fwdclassFSREdge{public:charfC;FSRVertexfTarget;//compilererrorFSREdge(charc,FSRVertextarget):fC(c),fTarget(target){}//compilererror};classFSRVertex{public:boost::uno

c++ - 在同一个 .obj 模型文件上,Assimp 查看器比 Assimp C++ 导入器快得多

assimp库提供了一种从文件加载3D.obj模型的好方法。但是我发现它附带的assimp_viewer.exe(我使用3.1.1版)在导入我的.obj文件(42Mb,已经简化)时比我加载相同模型的C++代码要快得多。查看器在几秒钟内加载文件,而我的C++程序(MSVS2013/Win64/Release)需要154秒才能完成。我在查看器和C++中尝试了导入程序后处理标志,但我无法弥合两者之间的差距。对原因有什么想法吗?这是我的C++代码:#include#include#include#include#include"assimp/Importer.hpp"#include"assi

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++ - ILINK32 错误 : Unresolved external '__fastcall System::TObject::NewInstance(System::TMetaClass *)' referenced from XXX. obj 的原因?

我从C++Builder2009的链接器中收到以下错误Unresolvedexternal'__fastcallSystem::TObject::NewInstance(System::TMetaClass*)'referencedfromXXX.obj?我们有一组Delphi文件(.pas)和一组C++Builder文件(.hpp和.obj),其中是从这些.pas文件生成的。一组文件被复制到另一台机器上。两台机器都安装了完全相同的C++Builder2009版本和相同的更新(最新:3+4)。当我在另一台机器上的C++Builder中创建一个空的VCL应用程序并将此集合中的一个obj文

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_

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)^~~~~~~~~~~~~~~~~~~我该如何解决?

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_