Code Monkey home page Code Monkey logo

vm_offset's Introduction

vm offset

Convenient way to get virtual method offset from virtual table using a pointer to member function(pmf)

This lib uses very tricky compiler implementation dependent methods to get the offset

example

struct A {
    virtual void f0() {}
    virtual void f1() {}
    virtual void f2() {}
};

const auto f2_offset = vm_offs::get_vm_index(&A::f2);

Tested on msvc, clang for windows(clang, clang-cl), and godbolt(itanium abi clang and gcc).

If it doesn't work correctly for you, consider using these methods directly.

const auto f2_index_itanium = vm_offs::get_vm_offset_itanium(&A::f2);
const auto f2_index_msvc = vm_offs::get_vm_offset_itanium(&A::f2);
const auto f2_index_clang = vm_offs::get_vm_offset_win_clang(&A::f2);

vm_offset's People

Stargazers

 avatar Oleg Dubrovsky avatar  avatar  avatar Serhii Kostenko avatar  avatar Oleg Lunko avatar  avatar  avatar Arzanis avatar Vladislav Abramov avatar  avatar  avatar

Watchers

 avatar

Forkers

a7t0fwa7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.