Skip to content

Instantly share code, notes, and snippets.

View simmplecoder's full-sized avatar

Olzhas Zhumabek simmplecoder

View GitHub Profile
#pragma once
#include <chrono>
#include <utility>
template <class Func, class ... Args>
std::chrono::duration<double> measure(Func function, Args&& ... args)
{
auto start = std::chrono::high_resolution_clock::now();
function(std::forward<Args>(args)...);
template <typename Engine = std::mt19937>
class random_bits_generator
{
Engine engine;
std::bernoulli_distribution distribution;
public:
template <typename OutputIt>
void operator()(OutputIt first, OutputIt last)
{
while (first != last)
#ifndef PRIME_NUMBERS_H
#define PRIME_NUMBERS_H
#include <vector>
#include <algorithm>
template <typename NumberType>
/*
NumberType requires:
Construction from unsigned int;
#pragma once
#include <vector>
template<typename T>
struct SimpleDestructableTrivialy
{
static constexpr bool value = std::is_trivially_destructible<T>::value;
};
template<typename T, bool = SimpleDestructableTrivialy<T>::value>
class SimpleDestroy
#pragma once
#include <numeric>
namespace impl_details
{
template <typename T, typename UnaryAdvanceOp>
class proxy
{
T value;
@simmplecoder
simmplecoder / typelist.h
Last active October 10, 2016 18:43
The header file provides useful type list manipulation function objects
#ifndef TYPELIST_H
#define TYPELIST_H
#include <utility>
#include <cassert>
#include <cstddef>
#include <tuple>
template <class ... Types>
class type_list {};
#include <string>
#include <fstream>
#include <vector>
#include <utility>
#include <cctype>
#include <iterator>
struct parse_result
{
std::vector<std::string> text;
#define EPSILON 0.001
#include <utility>
#include <bitset>
#include <cassert>
#include <iostream>
template <std::size_t dimensions>
using quadrant = std::bitset<dimensions>;
template <typename T>
#include <cstddef>
#include <type_traits>
#include <cstring>
namespace playground
{
template<typename T>
struct count_indirections
{
static constexpr std::size_t value = 0;

std::call

The purpose of std::call is to enable std::apply on non tuple arguments, and make it viable even for multi argument cases.

Current situation:

Lets consider some usage cases:

//first example
template <typename ... Types>
void process_instance(std::size_t id, Types&amp;&amp; ... args);