Good MACRO to define some function pointers and stuff

Credit : <https://github.com/realoriginal/titanldr-ng>
Author Twitter : @ilove2pwn_
/**
 *
 * Reflective Loader
 *
 * GuidePoint Security LLC
 *
 * Threat and Attack Simulation
 *
**/

#pragma once

/* Gets a pointer to the function or string via its relative offset to GetIp() */
#define G_SYM( x )	( ULONG_PTR )( GetIp( ) - ( ( ULONG_PTR ) & GetIp - ( ULONG_PTR ) x ) )

/* Sets a function in a specific region of memory */
#define D_SEC( x )	__attribute__(( section( ".text$" #x ) ))

/* Cast as a pointer with the specified typedef */
#define D_API( x )	__typeof__( x ) * x

/* Cast as a unsigned pointer-wide integer type */
#define U_PTR( x )	( ( ULONG_PTR ) x )

/* Cast as a unsigned pointer-wide type */
#define C_PTR( x )	( ( PVOID ) x )

/* Arch Specific Macros */
#if defined( _WIN64 )
	/* Get the end of code: x64 */
	#define G_END( x )	U_PTR( GetIp( ) + 11 )
#else
	/* Get the end of code: x86 */
	#define G_END( x )	U_PTR( GetIp( ) + 10 )
#endif

// Assuming the following function prototypes
void (APIENTRY *glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat);
void (APIENTRY *glClear)(GLbitfield);
void (APIENTRY *glViewport)(GLint, GLint, GLsizei, GLsizei);

typedef struct {
    D_API(glClearColor);
    D_API(glClear);
    D_API(glViewport);
} GraphicsAPI, *PGraphicsAPI;

Template in CPP

Ellipsis and variadic templates

Templates in C++ with Examples - GeeksforGeeks

template<typename... Arguments> class vtclass;

vtclass< > vtinstance1;
vtclass<int> vtinstance2;
vtclass<float, bool> vtinstance3;
vtclass<long, std::vector<int>, std::string> vtinstance4;

/// variadic class template definition
template <typename First, typename... Rest> class classname;
/// variadic function template
template <typename... Arguments> returntype functionname(Arguments... args);
template <typename... Types> void func1(std::vector<Types...> v1);

template<typename... Arguments>
void tfunc(const Arguments&... args)
{
    constexpr auto numargs{ sizeof...(Arguments) };

    X xobj[numargs]; // array of some previously defined type X

    helper_func(xobj, args...);
}

#include <iostream>

using namespace std;

void print() {
    cout << endl;
}

template <typename T> void print(const T& t) {
    cout << t << endl;
}

template <typename First, typename... Rest> void print(const First& first, const Rest&... rest) {
    cout << first << ", ";
    print(rest...); // recursive call using pack expansion syntax
}

int main()
{
    print(); // calls first overload, outputting only a newline
    print(1); // calls second overload

    // these call the third overload, the variadic template,
    // which uses recursion as needed.
    print(10, 20);
    print(100, 200, 300);
    print("first", 2, "third", 3.14159);
}

1
10, 20
100, 200, 300
first, 2, third, 3.14159