mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
AK: HashTable add a constructor that allows preallocation of capacity + Use in CppLexer. (#3147)
1. Add general utility to get array number of elements. 2. Add Needed API to AK::HashTable 3. Refactor CppLexer initialization
This commit is contained in:
parent
fc276946fb
commit
a68650a7b4
3 changed files with 166 additions and 135 deletions
|
@ -40,6 +40,13 @@ inline constexpr unsigned round_up_to_power_of_two(unsigned value, unsigned powe
|
|||
|
||||
namespace AK {
|
||||
|
||||
|
||||
template<typename T, typename SizeType = decltype(sizeof(T)), SizeType N>
|
||||
constexpr SizeType array_size(T (&)[N])
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline constexpr T min(const T& a, const T& b)
|
||||
{
|
||||
|
@ -497,6 +504,7 @@ using CopyConst =
|
|||
}
|
||||
|
||||
using AK::AddConst;
|
||||
using AK::array_size;
|
||||
using AK::ceil_div;
|
||||
using AK::clamp;
|
||||
using AK::Conditional;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue