This file contains 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> |
This file contains 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 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 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 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 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
#pragma once | |
#include <cstdint> | |
#include <string_view> | |
namespace fnv1b { | |
/* FNV-1b hash function with extra rotation | |
* https://en.wikipedia.org/wiki/Fowler–Noll–Vo_hash_function | |
*/ | |
template<typename T = std::size_t> | |
inline T hash(const char* str, std::size_t size) noexcept; |
This file contains 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
/* constexpr any_of against a list of constants */ | |
/** type_of_list<...>::type - helper structure for determining type of the first item in the list */ | |
template<auto ... List> struct type_of_list; | |
template<auto List> struct type_of_list<List> { using type = decltype(List); }; | |
template<auto First, auto ... List > struct type_of_list<First, List...> : type_of_list<First> {}; | |
/** type_of<...>::type - determines type of the first item in the list */ | |
template<auto ... List> | |
using type_of = typename type_of_list<List...>::type; |
This file contains 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 <iterator> | |
#include <utility> | |
// see live example on http://coliru.stacked-crooked.com/a/591f4db5a008cb5a | |
template<class Stream, class Vector, class Begin = decltype(std::begin(std::declval<Vector>()))> | |
inline Stream& operator<<(Stream& stream, const Vector& vect) { | |
const char* dlm = ""; | |
for(const auto& i : vect) { stream << dlm << i; dlm = ", "; } | |
return stream; | |
} |
This file contains 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
/************************************************************************/ | |
/* anotherclass.ccs definition of configuration options and sets for */ | |
/* MyAnotherClass */ | |
/************************************************************************/ | |
#include <ccs> | |
#pragma once | |
class MyAnotherClass; | |
namespace configuration { | |
template<> | |
struct Configuration<MyAnotherClass, Default> { |
This file contains 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
/** | |
* This file is intended for miculog per-class configuration | |
*/ | |
/* remove this message from your own copy of miculog.config */ | |
#pragma message "Default miculog configuration is in use" | |
/* add forward declaration of your classes here, | |
* embrace classes in namespaces, as needed |
NewerOlder