草庐IT

has_begin_member

全部标签

c++ - 是什么让 union 成员(member)活跃起来?

是什么让union成员活跃起来?我已经阅读了C++14标准的第9.5章(关于union的那一章),但是对于什么使union成员活跃,我还没有找到明确的答案。有一个注释:Ingeneral,onemustuseexplicitdestructorcallsandplacementnewoperatorstochangetheactivememberofaunion.例如,unionU{inti;shorts;}u;new(&u.i)int(42);好的,placementnew改变了activemember,很清楚了。但是在处理具有普通构造函数的类型时,我们通常不使用placementn

c++ - 不是从 .begin()ing 迭代一个 STL 容器并环绕

我有一个std::vector,为了简单起见,让我们说整数。std::vectorivec;ivec.push_back(1);ivec.push_back(2);...//omittingsomepushback's3to99ivec.push_back(100);迭代的标准方式是已知的std::map::iteratorit;for(it=ivec.begin();it!=ivec.end();it++)print();该迭代将打印1,2,3,...100。我想从预定义的索引开始遍历所有vector元素,而不是从it.begin()开始。我要打印3,4,5,6...99,100,1

c++ - 如何专门化 std::begin?

我正在尝试为自定义容器专门化std::begin。我这样做是因为我想对容器使用基于范围的for。这是我的:classstackiterator{…};classstack{…};#includetemplatestackiteratorstd::begin(stack&S){returnS.GetBottom();}我在begin特化的定义中遇到以下错误:Nofunctiontemplatematchesfunctiontemplatespecialization'begin'我做错了什么? 最佳答案 I'mtryingtospec

c++ - 如果为 false,则 std::is_member_function_pointer 不编译

我在寻找什么:我有一个模板化类,如果该类具有所需的函数,我想调用一个函数,例如:templatedo_something(){ifconstexpr(std::is_member_function_pointer::value){this->_t->x();//_tistypeofT*}}会发生什么:如果T没有带来函数,编译器就不会编译。小例子:#include#includeclassFoo{public:voidx(){}};classBar{};intmain(){std::cout::value::value编译器说:is_member_function_pointer.cpp

C++ 错误 : object of abstract class type is not allowed: pure virtual function has no overrider

继承有问题。我不知道我做错了什么。FigureGeometry.h#ifndefFIGUREGEOMETRY#defineFIGUREGEOMETRYstaticconstfloatPI=3.14159f;classFigureGeometry{public:virtualfloatgetArea()const=0;virtualfloatgetPerimeter()const=0;};#endifCircle.h#ifndefCIRCLE#defineCIRCLE#include"FigureGeometry.h"classCircle:publicFigureGeometry{fl

iphone - 警告 : XXXX has different visibility (default) in YYYY and (hidden) in ZZZZ

我正在尝试制作一个使用OpenCV和另一个C++库的iPhone应用程序。它似乎可以很好地编译和链接。它确实有效。只是我想摆脱这个丑陋的警告:ld:warning:std::vector>::_M_insert_aux(__gnu_cxx::__normal_iterator>>,intconst&)hasdifferentvisibility(default)in/Users/nacho4d/Documents/Projects/iOS/iAR/opencv_device/lib/libcxcore.a(cxdatastructs.o)and(hidden)in/Users/nach

c++ - (*i).member 是否比 i->member 效率低

拥有structPerson{stringname;};Person*p=...假设没有运算符被重载。哪个更有效(如果有的话)?(*p).name对比p->name在我脑后的某个地方,我听到一些铃声,*解引用运算符可能会创建一个对象的临时拷贝;这是真的吗?这个问题的背景是这样的案例:Person&Person::someFunction(){...return*this;}我开始怀疑,如果将结果更改为Person*并在最后一行简单地returnthis会不会有什么不同(在性能上)? 最佳答案 没有区别。即使标准说这两者是等价的,如果

c++ - 对 `Static Class Member variable inside Static member function' 的 undefined reference

我实际上正在尝试实现分页的模拟,在我的内存管理器中,我尝试创建一个静态页表,但是当我尝试打印它时它给出了引用错误。#ifndefMEMORYMANAGER_H#defineMEMORYMANAGER_H#include"memory.h"classMemoryManager{private:PhysicalMemoryRAM;LogicalMemoryVM;intoffsetValue;staticint**pageTable;public:MemoryManager();booladdProcess(TimeSliceRequest);voidprintVirtualMemory()

java - 在 Windows 上设置 hadoop.tmp.dir 会出现错误 : URI has an authority component

我试图在我的hdfs-site.xml中指定HDFS文件的基本目录在Windows7下(我从源代码构建的Hadoop2.7.1,使用JavaSDK1.8.0_45和WindowsSDK7.1)。我不知道如何提供指定驱动器的路径。我的hdfs-site.xml看起来像这样:dfs.replication1hadoop.tmp.dirXXX我尝试了XXX的各种值,我用hdfsnamenode-format测试过,所有这些都会导致以下2个错误之一:XXX=D:/tmp/hdp:15/07/1023:38:33ERRORnamenode.NameNode:Failedtostartnameno

python - 属性错误 : 'XPathExpr' object has no attribute 'add_post_condition'

我正在尝试安装pyquery在Windows上,当我尝试像这样选择d('p:first')时出现以下错误。其他一切似乎都在工作。知道我错过了什么吗?这个问题只发生在我的Windows机器上,在我的MAC上工作正常。Python2.7.3(default,Apr102012,23:31:26)[MSCv.150032bit(Intel)]onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>frompyqueryimportPyQueryaspq>>>d=pq("")>>>d('p:first')T