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> | |
#if __cplusplus > 201709L | |
#include <bit> | |
template<typename T> | |
constexpr int countr_zero(T val) noexcept { return std::countr_zero(val); } | |
template<typename T> | |
constexpr int popcount(T val) noexcept { return std::popcount(val); } | |
#else | |
template<typename T, typename = std::enable_if_t<std::is_integral<T>::value,T>> |
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 <iostream> | |
#include <stdexcept> | |
#define TRACE() \ | |
std::cout << __PRETTY_FUNCTION__ << std::endl; | |
namespace details { | |
template<class Parameter> | |
struct expected { | |
template<class Argument> |
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 <iostream> | |
#include <stdexcept> | |
#define TRACE() \ | |
std::cout << __PRETTY_FUNCTION__ << std::endl; | |
namespace details { | |
template<class Parameter> | |
struct expected { | |
template<class Argument> |
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 <iostream> | |
#include <stdexcept> | |
#define TRACE() \ | |
std::cout << __PRETTY_FUNCTION__ << std::endl; | |
namespace details { | |
template<class Class> | |
struct is_virtual_parameter { | |
static constexpr bool value = | |
std::is_polymorphic_v<std::remove_reference_t<Class>> and |
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> | |
// is_constexpr implementation | |
// Live example https://godbolt.org/z/79adTjdax | |
template<auto F> | |
struct constexpr_true : std::true_type {}; | |
template<auto F> | |
static auto test_constexpr(int) -> constexpr_true<F()>; | |
template<auto F> |
OlderNewer