Skip to content

Instantly share code, notes, and snippets.

@gatchamix
gatchamix / constexpr_map.cpp
Last active May 12, 2021 14:52
constexpr map
#include <utility>
#include <array>
template <auto...>
struct value_list
{};
template <class T, auto... Keys>
struct map_
{
@gatchamix
gatchamix / jump_list.cpp
Last active August 28, 2017 23:18
hard jump-list generator
#include <array>
#include <type_traits>
#include <utility>
//
template <auto... Vs>
struct auto_t
{ static auto constexpr size = sizeof...(Vs); };
@gatchamix
gatchamix / signature_detection.cpp
Last active August 18, 2017 09:40
member function exact signature matching
#include <type_traits>
#include <functional>
//
struct validator
{
template <template <class...> class, class...>
static auto constexpr is_valid(...)
-> std::false_type;
@gatchamix
gatchamix / spiral_generator.cpp
Last active March 12, 2020 15:49
scalable cache friendly spiral sequence generation (SNSystems)
#include <cstddef>
#include <algorithm>
#include <array>
#include <iostream>
using std::size_t;
auto constexpr calculate(size_t row, size_t column, size_t width, size_t height, size_t value = 0)
{
--width;