Browsing Tag
cpp
24 posts
C++ 指向類別成員的指位器的實作細節
C++ 可以定義指向成員函式的指位器, 不過因為成員函式可能是虛擬函式, 如何能夠透過指向成員函式的指位器達到呼叫正確的成員函式呢?本來就來簡單探究。(本文均以 g++ 為例, 並且只探討單純的單一繼承)。 指向非虛擬函式的指位器 首先來看個簡單的範例, 建立指向非虛擬函式的指位器: #include using namespace std; class A { public:…
Rust vs. C++: Modern Developers’ Dilemma
I have come to realize one common dilemma: Many developers are going back and forth between Rust and…
Leetcode Solution: #206: Reverse Linked List 🐬
Question Type: Medium 🎚️ Complexities: Time: O(n), Space: O(n) 🚩 Code: 👇 class Solution { public: ListNode* reverseList(ListNode*…
Leetcode Solution: #1669 Merge In Between Linked Lists 🚀
Question Type: Medium 🎚️ Complexities: Time: O(n), Space: O(1) 🚩 Code: 👇 class Solution { public: ListNode* mergeInBetween(ListNode*…
Declaring Multiple Variables in a “for” Loop Initialization Clause
Introduction As you know, the syntax of the for statement in C and C++ is: for ( init-clause…
Unions & std::variant in C++
Introduction A union in C++ is almost like a union in C (so, if you haven’t read that…
std::optional? Proceed with caution!
The std::optional type is a great addition to the standard C++ library in C++ 17. It allows to…
Unlocking the Power of Native Modules in JavaScript: An Introductory Guide
You may also read this blog post in my blog for a better experience Disclaimer ⚠️ The topic…
AVL Tree
In this tutorial, you will learn what an avl tree is. Also, you will find working examples of…
ReductStore Client SDK for C++ v1.3.0 with Labels Support
We are excited to announce the release of ReductStore Client SDK for C++ v1.3.0! This release includes support…