Skip to content

Instantly share code, notes, and snippets.

@moyang
moyang / function.cpp
Created October 20, 2025 06:05 — forked from Junch/function.cpp
std::function implementation
/******************************************************************************
https://stackoverflow.com/questions/18453145/how-is-stdfunction-implemented
*******************************************************************************/
#include <iostream>
#include <memory>
template <typename T>
@moyang
moyang / VTable Notes on Multiple Inheritance in GCC C++ Compiler v4.0.1.md
Last active May 3, 2025 20:43
VTable Notes on Multiple Inheritance in GCC C++ Compiler v4.0.1

VTable Notes on Multiple Inheritance in GCC C++ Compiler v4.0.1

http://www.cse.wustl.edu/~mdeters/seminar/fall2005/mi.html#basics

The Basics: Single Inheritance

As we discussed in class, single inheritance leads to an object layoutwith base class data laid out before derived class data. So if classes A and B are defined as: