This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#define auto_assert(...) \ | |
[](auto expression) \ | |
{ \ | |
if constexpr (noexcept(expression())) \ | |
{ static_assert(expression()); } \ | |
else \ | |
{ assert(expression()); } \ | |
} \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <string> | |
#include <string_view> | |
using namespace std::literals; | |
// | |
auto constexpr checker(...) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <algorithm> | |
#include <tuple> | |
template <class... Ts> | |
auto constexpr persist(Ts volatile... ts) | |
{ std::tuple{ ts... }; } | |
auto constexpr hamming_weight(std::uint16_t const mask, | |
std::uint16_t const value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <string> | |
#include <string_view> | |
using namespace std::literals; | |
// | |
template <class F, class... Args, | |
class = decltype(std::declval<F&&>()(std::declval<Args&&>()...))> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
#include <iterator> | |
#include <array> | |
#include <string_view> | |
// | |
template <auto...> | |
struct auto_list | |
{}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
// | |
template <class F, class... Args, | |
class = decltype(std::declval<F&&>()(std::declval<Args&&>()...))> | |
auto constexpr is_valid_impl(int) | |
{ return true; } | |
template <class F, class... Args> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <std::size_t N, class T> | |
struct tuple_elem | |
{ | |
constexpr tuple_elem(T&& val) | |
: val_{ std::forward<T>(val) } | |
{} | |
template <auto I, std::enable_if_t<I == N>* = nullptr> | |
auto constexpr& operator[](constant<I>) | |
{ return val_; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <utility> | |
#include <cstddef> | |
#include <string_view> | |
#include <iterator> | |
#include <limits> | |
#include <tuple> | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <limits> | |
#include <utility> | |
// | |
template <class... Ts> | |
struct type_t | |
{ static auto constexpr size = sizeof...(Ts); }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <utility> | |
#include <limits> | |
#include <array> | |
// | |
template <auto V_> | |
struct auto_t | |
{ |