草庐IT

path2class

全部标签

c++ - c++ 中是否有任何类是所有类的父类(super class)?

像javaJava.lang.Object是所有类的父类(superclass)所以在C++中是否有任何类像对象? 最佳答案 不,没有。在C++中,您为使用的东西付费,而不是更多。你可以有void*可以指向任何东西,或者如果有意义的话,写你自己的基类。 关于c++-c++中是否有任何类是所有类的父类(superclass)?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/1831

c++ - 如何通过 C++ 可执行文件中的 list 启用 "Long Path Aware"行为?

我正在尝试关注Microsoftdocumentation解除Windows10下API中的MAX_PATH文件路径限制。它说:Youcanalsoenablethenewlongpathbehaviorperappviathemanifest:true所以,第一个问题。是否可以在VisualStudio2017的项目属性中启用它?第二个问题:我没有找到上面的答案,所以我决定走手动路线:我创建了additional.manifest文本文件:true然后我将它添加到项目属性中:但是当我编译它时,它给了我这个警告,并且该list在应用程序运行时似乎没有任何效果:1>additional.

c++ - 使用 boost::successive_shortest_path_nonnegative_weights 的最小成本最大流

我需要使用计算流量网络的最小成本最大流量boost::successive_shortest_path_nonnegative_weights()BGL(v1_60_0)中可用的函数。如documentation中所述,thedirectedgraphG=(V,E)thatrepresentsthenetworkmustbeaugmentedtoincludethereverseedgeforeveryedgeinE.Thatis,theinputgraphshouldbeGin=(V,{EUET}).[...]TheCapacityEdgeMapargumentcapmustmape

c++ - 模板类中函数指针的成员给出错误 : must be a class or namespace when followed by '::'

我试图在C++中声明一个模板函数指针。templateclassMyClass{public:typedefconstunsignedchar*(T::*MyTemplatedEvent)(unsignedlong&myParameter);};但出于某种原因,我不断收到此错误:'T':mustbeaclassornamespacewhenfollowedby'::'有人能告诉我哪里做错了吗?编译器应该知道T是一个类。它在MyClass声明上方这样说...... 最佳答案 对于T::*MyTemplatedEvent,您期望T是类类

c++ - 非类型模板参数 : how to pass reference to base class object?

似乎无法传递对的引用派生对象的基类对象作为模板参数,正如我在这里尝试做的那样:structa{int_v;constexpra():_v(0){}constexpra(intv):_v(v){}};structc:publica{constexprc():a(){}constexprc(intv):a(v){}};externconstcdefault_a;constexprconstcdefault_a{1};consta&c_as_a=default_a;//^--thisline(16)causesnoerror-ccanbeconvertedtoatemplatestructb

C++ 模板 "class type"错误

我一直在研究一个链表模板类来对各种变量做同样的事情,并设法解决了大部分问题。除了编译时,我得到这些:g++-Wall-otemplate_testtemplate_test.cppInfileincludedfromtemplate_test.cpp:1:0:LinkedList.h:50:11:error:declarationof‘classType’LinkedList.h:7:11:error:shadowstemplateparm‘classType’LinkedList.h:51:30:error:invaliduseofincompletetype‘classLinked

python - 需要哪个 $path 以便 g++/pybind11 可以找到 Python.h?

我开始使用pybind11(在Ubuntu16.04和Python2.7上)。为了试水,我围绕我的C++库创建了一个无操作的包装器。唉,编译找不到Python.h:$g++-std=c++0x-fPIC-pedantic-g-Wno-missing-field-initializers-Wno-switch-Wno-multichar-ftree-vectorize-ftree-vectorize-mssse3backend.huvc-v4l2.cppwrap.cpp-owrap.sobackend.h:4:9:warning:#pragmaonceinmainfile#pragmao

c++ - 来自 Xcode 8.3.2 : Non-portable path to file - specified path differs in case from file name on disk 的错误警告

出于某种原因,我的代码库突然开始收到数以千计的此类警告。但到目前为止,所有有问题的文件和路径都是完全正确的,与我在磁盘上看到的与Finder相匹配。他们是不是在暗地里另有幕后?当问题实际上并不存在时,为什么Xcode会生成这些警告?尽管http://stackoverflow.com/questions/43067017/non-portable-path-to-file-file-h-specified-path-differs-in-case-from-file-na是关于相同的警告,在这种情况下我已经验证导入路径与磁盘上的文件名匹配。 最佳答案

c++ - 为什么 injected-class-name 有时不被视为类模板中的模板名称?

SourceInthefollowingcases,theinjected-class-nameistreatedasatemplate-nameoftheclasstemplateitself:itisfollowedbyitisusedasatemplateargumentthatcorrespondstoatemplatetemplateparameteritisthefinalidentifierintheelaboratedclassspecifierofafriendclasstemplatedeclaration.所以我尝试检查所有3种情况(另外在基本歧义的情况下,尽管我

c++ - 对齐 : warning C4316 in all classes that have aligned members

今天我遇到了很多麻烦,因为我跟踪了一个非常隐蔽的腐败漏洞。我想如果我真的注意警告就不会那么难找到它,但由于找不到有关为什么弹出此特定警告的相关信息,我让它滑动了,这是一个错误。所以这是VisualStudio2013给我的有罪警告:warningC4316:objectallocatedontheheapmaynotbealigned16它是在通过const引用将align(16)临时传递给构造函数时生成的,如以下代码所示:classVector{};__declspec(align(16))classVectorA{};classShape{public:Shape(constVec