1#ifndef PROFILECOUNTERS_HH
2#define PROFILECOUNTERS_HH
86template<
bool ENABLED,
typename ENUM>
97 std::cout <<
"-- Profile counters: " <<
EnumTypeName<ENUM>() <<
" -- " <<
static_cast<void*
>(
this) <<
'\n';
98 for (
auto [i, count] :
enumerate(counters)) {
105 ++counters[size_t(e)];
109 static constexpr auto NUM = size_t(ENUM::NUM);
110 mutable std::array<unsigned, NUM> counters = {};
116template<
typename ENUM>
std::ostream & operator<<(std::ostream &os, EnumTypeName< E >)=delete
ProfileCounters & operator=(const ProfileCounters &)=delete
ProfileCounters(ProfileCounters &&)=delete
ProfileCounters & operator=(ProfileCounters &&)=delete
ProfileCounters(const ProfileCounters &)=delete
constexpr auto enumerate(Iterable &&iterable)
Heavily inspired by Nathan Reed's blog post: Python-Like enumerate() In C++17 http://reedbeta....