Skip to content

Instantly share code, notes, and snippets.

Avatar
🇺🇦
🇺🇦

Oleksiy Slyshyk slyshykO

🇺🇦
🇺🇦
View GitHub Profile
View raii_malloc.cpp
#include <memory>
int main()
{
auto Data =
std::unique_ptr<double, decltype(free)*>{
reinterpret_cast<double*>(malloc(sizeof(double)*50)),
free };
return 0;
}
@slyshykO
slyshykO / snprintf.cpp
Last active Mar 14, 2018
snprintf with zero ending
View snprintf.cpp
template <uint32_t N, typename... Args>
void _snprintf(char (&buf)[N], const char* format, Args&&... args)
{
snprintf(buf, N, format, args...);
buf[N-1] = '\0';
};
@slyshykO
slyshykO / FastFunc.hpp
Created Feb 20, 2018 — forked from SuperV1234/FastFunc.hpp
Don Clugston's fast delegate C++11 implementation
View FastFunc.hpp
#ifndef SSVU_FASTFUNC
#define SSVU_FASTFUNC
#include <cstring>
#include <type_traits>
#include <cassert>
#include <cstddef>
#include <memory>
#include <new>
#include <utility>