Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <type_traits>
template<typename T, typename U>
constexpr bool same()
{
return std::is_same<T,U>::value;
}
// inspired by https://gist.github.com/oliora/b8207b4a74a6bb868ef4
// a bit less text, less standard way
#include <cassert>
#include <utility>
#include <algorithm>
#include <type_traits>
template <typename T>
constexpr bool has_own_find(...) { return false; }
@pudov
pudov / bubble.py
Last active February 22, 2016 20:27
from random import sample
from time import time
def buble_sort(a):
for i in xrange(len(a)):
for j in xrange(1, len(a) - i):
if a[j-1] > a[j]:
temp = a[j]
a[j] = a[j-1]
a[j-1] = temp
@pudov
pudov / containers_benchmark.cpp
Last active May 18, 2018 12:22
simple c++ containers performance benchmark
#include <cstdint>
#include <cassert>
#include <typeinfo>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <chrono>
#include <ratio>
#include <array>