草庐IT

swift-class

全部标签

Swift 4:如何使用ios11视觉框架从面部地标点创建面部图

我正在使用iOS11视觉框架实时产生面部标志性点。我能够通过面部标志性点的UibezierPath来获取面部标记点,并覆盖相机层。但是,我想获得右下图的东西。目前,我有一些看起来像左图的东西,我尝试循环浏览这些点并添加中点,但是我不知道如何从这些点中生成所有这些三角形。我将如何从左侧点从右侧生成地图?我不确定我是否可以使用所有的要点,并不是说它会有所帮助,但是我也有整个脸部边界框的要点。最后,是否有任何框架可以让我识别我需要的所有要点,例如OpenCV或其他内容,请告诉我。谢谢!这是我一直在使用的代码https://github.com/droidsonroids/visionfacedete

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

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

c++ - GMock : How to return mock class variable as the return value

我是第一次尝试使用GMock(用于C++的谷歌模拟框架)。我有以下类(class):classLocalCache{public:virtualtime_tGetCurrentTime()=0;virtualintAddEntry(conststd::stringkey,std::string&value);virtualintGetEntry(conststd::stringkey,std::string&value);};GetEntry方法调用GetCurrentTime调用。我想模拟GetCurrentTime方法,以便我可以在测试中提前时钟以测试作为GetEntry调用的一部

c++ - 为什么 Builder 模式比在正在创建的 Class 对象中带有参数的 Constructor 更好?

为什么我们不能在构造函数本身中执行不同的构建步骤。如果构建步骤采用参数,为什么不能将它们作为参数提供给构造函数并在构造函数中用于创建对象。据我所知,在Builder模式中,客户端要创建哪个特定对象;那么在正在创建的类的对象中使用构建器而不是带有参数的构造函数有什么优势? 最佳答案 哦!我得到它。我正在查看维基百科示例并意识到Builder为何有用。当客户端不知道将哪些参数传递给构造函数时,这很有用,因为它非常复杂,因此无法直接调用构造函数并获取对象。因此,他向ConcreteBuilders寻求帮助,他们知道将哪些参数传递给构造函数

我如何从Coredata Swift获得最近的用户聊天

我有两个实体朋友,现在消息我想收到朋友的最新消息,我该怎么做朋友包含这些东西Friend{name:Stringid:Intemail:String}消息包含这些东西,也有从朋友到消息之间的一对多关系Message{id:Stringtext:Stringcreated_at:Date/...//andmanythings}看答案您可以通过类似的描述符获得用户的最新消息:-letfetchRequest=NSFetchRequest.init(entityName:"Message")fetchRequest.sortDescriptors=[NSSortDescriptor.init(key

c++ - 移动构造函数和赋值运算符 : why no default for derived classes?

为什么没有为派生类创建默认移动构造函数或赋值运算符?证明我的意思;具有此设置代码:#includestructA{A(){}A(A&&){throw0;}A&operator=(A&&){throw0;}};structB:A{};以下任一行抛出:Ax(std::move(A());Ax;x=A();但以下都没有:Bx(std::move(B());Bx;x=B();以防万一,我使用GCC4.4进行了测试。编辑:后来使用GCC4.5进行的测试显示了相同的行为。 最佳答案 通读0xFCD中的12.8(12.8/17特别是移动构造函数)