C++ ?? ?? ???? ??? ??, ??? ??? ??? ??
May 31, 2024 pm 07:03 PM?? ?? ???? ?? ?? ?? ???? ??? ??? ?? ?? ????? ??? ???? ?? ?? ??? ??? ????? ??????. ???? ???? ?? ?? ????? ? ?? ?? ?? ???? ??? ? ? ???? ???? ??? ?? ?? ???? ????? ??? ??? ?????.
C++ ?? ?? ??? ? ??? ??: ??? ?? ??
??
???? ??? ?? ??? ?? ??? ?? ?? ??? ??? ? ??? ?? ?? ?? ?????? ?? ?????. . C++??? ???? ?? ?? ???? ?? ?????. ??? vtable? ?? ?? ?? ?? ?? ??? ??? ??? ? ????.
?? ?? ???
?? ?? ???? ?? ??? ?? ???? ??? ??????. ?? ??? ???? ????? ?? ?? ???? ???? ??? ?? ??? ????. ??? ?? ??? ?? ??? ?? ??? ??? ??? ??? ? ????.
??? ??
?? ?? ???? ??? ??? ?????. ???? ?? ??? ???? ? ???? ?? vtable? ?????. ?? ?? ?? ??????? ?? ?? ?? ??? ??? ????? ??? ? ????.
???: ?? ?? ??? ??
?? ?? ??? ??? ??? ??? ? ?? ??? ?? ?? ???? ???? ????. ?? ?? ???? ???? ?? ?? ?? ???? ??? ??? ?? ?? ????? ??? ? ????.
?? ??
?? ??? ?? ??? ?????.
class Shape { public: virtual void draw() = 0; }; class Circle : public Shape { public: void draw() override { // Draw a circle } }; class Rectangle : public Shape { public: void draw() override { // Draw a rectangle } };
??? ?:
? ???? Shape
, Circle
? Rectangle
?? ?? ?? ?? ???? ????. Shape
?? ?? ??? ?? ??? ??? ??? ?????. Shape
、Circle
和 Rectangle
都有自己的虛函數(shù)表。這會(huì)浪費(fèi)內(nèi)存空間,因?yàn)?Shape
沒有虛函數(shù)。
優(yōu)化后通過虛基類:
class ShapeBase { public: virtual void draw() = 0; }; class Shape : public ShapeBase { }; class Circle : public Shape { public: void draw() override { // Draw a circle } }; class Rectangle : public Shape { public: void draw() override { // Draw a rectangle } };
優(yōu)化結(jié)果:
通過使用虛基類 ShapeBase
,Circle
和 Rectangle
現(xiàn)在可以共享同一個(gè)虛函數(shù)表。這消除了 Shape
?? ?? ???? ?? ??? ?: rrreee
??? ??:
?????? ?? ???ShapeBase
, Circle
? Rectangle ?? code> code>? ?? ??? vtable? ??? ? ????. ??? ?? <code>Shape
? vtable? ???? ??? ????? ?????. ???????????????? ?? ???? ???? C++? ?? ?? ???? ?? ???? ??? ??? ?? ? ????. ??? ?? ?? ?? ?? ?? ?? ?????? ??? ???? ???? ? ????. ??? ??? C++ ?? ?? ???? ??? ??, ??? ??? ??? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PHP? AI ??? ?? ??? ??? ?? AI ??? API (? : OpenAI, HuggingFace)? ?????? ???? ??? ???, API ??, ?? ?? ? ?? ?????? ???? ????. 2. ??? ??? ??? ??? AI ???? ???? ????. ?? ??? API, ??? ?? ? ??? ??? ???? ????. 3. ?? ??? ?? ??, ??, ??, ???, ??? ????? ? GPT ?? BART/T5? ?? ?? ??? ???????. 4. ?? ????? ??, ??? ?, ?? ?? ? ?? ?? ??? ?????. ?? ??? ???? ????? ???? ??? ???? ?? ?? ?? ? ??, ???? ?? ??, ?? ??, ?? ?? ? ??? ???????.

?? ?? ??? ?? ??? ????? ??? ? ????. 1. I-th ??? 1?? ?????? : N & (1 ??

??? ?? ??? ? ???? ???? ? ???? C? ??? ???? ?? ?????. 1. ??? Intadd (Inta, Intb)? ?? ?? ? ??? ?? ?????. 2. ??? ?? ? ? ?? ??? ???? ??? ?? ? ? ?? ??? ??? ?????. 3. ?? ???? ??? ??? ??? ???? ?? voidGreet (StringName)? ?? ?? ???? void? ?????. 4. ??? ???? ?? ???? ?????, ??? ???, ?? ??? ???? ? ? ???, ?? C ?????? ?? ?????.

decltype? ??? ??? ?? ??? ???? ?? C 11?? ???? ??????. ?? ??? ???? ?? ??? ???? ????. 1. decltype (expression) ? ??? ???? ??? ???? ????. 2. ?? ?? decltype (x)? ?? ???? ???? ??, decltype ((x))? lvalue ???? ?? X? ?????. 3. ????? ?? ?? ?? ?? ?? AUTO-> DECTYPE (t u)? ?? ?? ?? ???? ? ?????. 4. ??? ?? ??? decltype (vec.begin ())? ?? ???? ???? ??? ? ? ????. it = vec.begin (); 5. ????? ?? ?? ???? ?????

C Follerexpressions? Variadic ?? ?? ????? ?? ??? ????? ?? C 17? ?? ?? ? ?????. 1. ?? ?? (Args ...) ?? (1,2,3,4,5)? ?? ???? ????? ??? ?????. 2. ????? (Args && ...) ?? ?? ??? ???? ???? ? ??? true? ?????. 3. ?? (std :: cout

AbinarySearchTree (BST) IsabinaryTreewheretHeleftSubtreeContainlynodeswithValuessThanthenode 'svalue, grightSubtreecontainsonlynodeswithValuestthanThantenode'svalue ? bothsubtreesmustalsbsts;

C? ?? ?? ?? ??? ??? ????? ?? ???? ????? ??? ????. ?? ??? (?? : ??)??? ???, ?? intarr [] ?? std :: vectorvec? ?? ??? ? STL ????? ?????. ?? (? : conststd :: string & name)? ???? ?? ?? ??? ??? ?? ???? ??? ? ????. ??? ??? ????. 1. ???? ???? ??? ???? ????. 2. ??? ????? ???? ?? ??? ??? ?????. 3. ?? ???? ??? ???? ?? ?? ??? ?????. ??? ?? ???? ?????? ??? ????? ???? ??? ? ????.

C?? Python ????? ????? Pythoncapi? ?? ??? ?????. ?? ???? ??? ? ?? ??? ???? ??? ?? ? ?? ????? ???? ??????. ?? ??? ??? ????. 1. Py_Initialize ()? Python ???? ??????. 2. pyimport_import ()? Python ???? ?????????. 3. pyobject_getattrstring ()? ?? ?? ??? ????. 4. pyobject_callobject ()? ???? ?? ??? ???? ??? ??????. 5. Py_decref () ? py_finalize ()? ???? ???? ???? ???? ?????. ? ???? Hello? ????? ?????
