C++ Study Notes

Share

C++ Primer

C++ Primer is a classic C++ book. Studying it helps build a deeper understanding of C++. Since computer graphics depends heavily on C++, I started learning from this book and recorded notes here.

v2-59ab4eb7a1576a5b61a4f90ae74fbbf4_720w

Chapter 15

Inheritance access modifiers: public, protected, and private.

public: all access permissions of base-class members remain unchanged in the derived class.

protected: all public members of the base class become protected members in the derived class.

private: all base-class members, whether public, protected, or private, become private members in the derived class.

In short, the access changes are shown below:

Inheritance modifier Base public Base protected Base private
public public protected private
protected protected protected private
private private private private

Chapter 17: Special Library Facilities

Regular Expressions: A 30-Minute Tutorial

Code Repository

CPP_Primer_Practice

C++ Related

Inspecting OOP Memory Layout

Visual Studio’s cl tool can conveniently inspect the memory layout of a class.

Using Visual Studio 2022 as an example:

Find this in the Start menu:

Visual Studio 2022 -> x64 Native Tools Command Prompt for VS 2022

Switch to the current directory. If you need to switch drives, such as to drive D, enter D: first. Then run:

cl /d1 reportSingleClassLayoutXXX [filename]

Here XXX is the class name, and [filename] is the source file.

For example, if the class name is Milk and the file is decorator.cpp:

cl /d1 reportSingleClassLayoutMilk decorator.cpp

Then you can see the layout result for class Milk:

—–2024-03-26-113559

When a class has virtual functions, a vtable pointer is inserted at the beginning of the class. With multiple inheritance, each inherited base adds one.

Read more

可多路视频播放的VisionOS 媒体查看器开发

可多路视频播放的VisionOS 媒体查看器开发

开发一款能够同时播放多个视频的vision pro媒体查看器。 0:00 /0:40 1× 缘起 Vision Pro 发布时我就特别想买,毕业工作后终于有资金购入并加入Apple开发者计划,从今年五月到现在也用了快小半年,用起来确实挺爽。 但是有些痛点还是很难受,其中一个痛点就是无法同时播放多个视频音频(实际上VisionOS提供了同时播放音频的API,但是似乎我用的APP都是不遵守🤣 导致都在抢占),因此为了满足我自己的这个痛点,也学习一下Vision OS 的应用开发,甚至完成度足够的话考虑上架App Store,便有了这个目标是多视频同时播放的媒体查看器项目。 现有工作 我购买了4XVR、Infuse、Moon Player、ES 文件助手(这款只有iPad OS版,不是专供Vision OS的),这几个月体验下来,全都存在我提到的和其他APP抢占音频通道,无法同时播放的问题,其他的我的主观的体验如下: 4XVR:使用最多,用起来最舒服,格式支持很全,VR视频也能看,号称全v

By Feiran Yu