Core/Console: Add CountOf function

Former-commit-id: 8ea1456bc8debae102ca616176febb15d3759d17
This commit is contained in:
Lynix
2016-01-07 13:33:26 +01:00
parent b9ec4a4fc4
commit adf5946711
2 changed files with 14 additions and 0 deletions

View File

@@ -62,6 +62,18 @@ namespace Nz
return hash->End();
}
template<typename T, std::size_t N>
constexpr std::size_t CountOf(T(&name)[N]) noexcept
{
return N;
}
template<typename T>
std::size_t CountOf(const T& c)
{
return c.size();
}
// Algorithme venant de CityHash par Google
// http://stackoverflow.com/questions/8513911/how-to-create-a-good-hash-combine-with-64-bit-output-inspired-by-boosthash-co
template<typename T>