Way better function ptrs in MODERN C++

Posts 1–2 of 2 · Page 1 of 1
Way better function ptrs in MODERN C++
Heres a much cleaner and much more modern way of doing fn ptrs and up

Code:
void init()
{
	AllocConsole();

	freopen("CONIN$", "r", stdin);
	freopen("CONOUT$", "w", stdout);

	std::function<std::int32_t(std::uint32_t)> fn_ptr_sendpacket	;

	fn_ptr_sendpacket = (std::uint32_t(__cdecl*)(std::int32_t))(0x00424D60);

	std::function<std::int32_t(std::uint32_t)> CL_SendPacket = fn_ptr_sendpacket;

	while (true)
	{
		CL_SendPacket(99999999); /* example of calling it */
	}
}
Here is an example, have fun!
Why is it "modern"
I haven't heard about any big C++ changes
It's as old as it has always been
Maybe it's time to switch to a real "modern" language :P

Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us