Skip to content

Instantly share code, notes, and snippets.

namespace detail
{
template <std::size_t I, class Tuple>
struct aligned_offset_impl
{
constexpr std::size_t operator()() const noexcept
{
using current_element_t = std::tuple_element_t<I, Tuple>;
using previous_element_t = std::tuple_element_t<I - 1, Tuple>;
@Ostoic
Ostoic / constexpr_array_algorithms.cpp
Last active January 28, 2018 01:53
A few constexpr algorithms for use with std::array
#include <array>
#include <iostream>
#include <type_traits>
#include <vector>
// Array factory for type deduction
template <typename... Ts>
constexpr auto make_array(Ts&&... ts) noexcept
{
return std::array<std::common_type_t<Ts...>, sizeof...(Ts)>{std::forward<Ts>(ts)...};
#include <iostream>
#include <vector>
#include <Windows.h>
#include <Tlhelp32.h>
// The normal Toolhelp32.h process snapshot enumeration. This example was taken
// mostly from MSDN, with a few modifications.
std::vector<int> test_toolhelp()
{