Skip to content

Instantly share code, notes, and snippets.

View dakka's full-sized avatar

David Dight dakka

View GitHub Profile
@dakka
dakka / call_once_with_result.hpp
Last active September 11, 2023 21:06
call_once_with_result - a std::call_once storing the callable object's result and making it available, C++17
/-----------------------------------------------------------------------------------------
// Copyright (C) 2022-23 Fix8 Market Technologies Pty Ltd
// by David L. Dight
//
// call_once_with_result - a std::call_once storing the callable object's result and making it available
// class once_with_result and function call_once_with_result
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
@dakka
dakka / pow_cpp20_template.cpp
Last active May 25, 2023 07:43
make_pow_array - create compiler generated constexpr C++20 arbitrary base and size power tables as std::array. Examples include uint128_t, bases 2, 3, 5, 8, 10, with constexpr printer and demangler. Uses folding, variable templates, constraints.
//-----------------------------------------------------------------------------------------
// Copyright (C) 2022-23 Fix8 Market Technologies Pty Ltd
// by David L. Dight
//
// make_pow_array - create compiler generated constexpr C++20 arbitrary base and size power
// tables as std::array. Examples include uint128_t, bases 2, 3, 5, 8, 10, with constexpr
// printer and demangler. Uses folding, variable templates, constraints.
//
// Distributed under the Boost Software License, Version 1.0 August 17th, 2003
//