Skip to content

Instantly share code, notes, and snippets.

View altalk23's full-sized avatar
💖
:3

alk altalk23

💖
:3
View GitHub Profile
@altalk23
altalk23 / typeinfo_cast_itanium.cpp
Last active June 19, 2022 00:56
typeinfo cast for multiple inheritance using typeid name comparison
#include <type_traits>
#include <typeinfo>
#include <cstring>
#if __x86_64__
using uinthalf_t = uint32_t;
using inthalf_t = int32_t;
#else
using uinthalf_t = uint16_t;
using inthalf_t = int16_t;
@altalk23
altalk23 / address of virtual.cpp
Last active December 19, 2023 02:56
Getting the address of a virtual function in c++, works both in msvc x86 and clang macos x64
#include <cstdlib>
#include <stddef.h>
#include <iostream>
#define CONCAT2(x, y) x##y
#define CONCAT(x, y) CONCAT2(x, y)
#if defined(_WIN64) || defined(__x86_64__)
#define NEST1(macro, begin) \
macro(CONCAT(begin, 0)) \