Skip to main content
11 votes
Accepted

Optimized data structure mapping finite set of integers to values in C++

Design review You are massively over-complicating the problem You call it a map, and you talk about using integers as keys. But… in reality, because your keys are small, you are just using indices. So ...
indi's user avatar
  • 12k
4 votes
Accepted

Generic Dynamic Array Implementation

Types typedef int32_t i32; makes it slightly faster to type the type name, but much harder for the experienced C programmer to read. ...
Cris Luengo's user avatar
  • 6,052
4 votes

Optimized data structure mapping finite set of integers to values in C++

range check There's no provision for validating key against N, not even in a debug build. ...
J_H's user avatar
  • 30.8k
3 votes

Presence of UB and memory usage of a std::array initialization

It's inefficient The idea of constructing an array from a generator is really nice. However, it is not efficient at all. You are first constructing the whole array in a temporary storage location, ...
G. Sliepen's user avatar
  • 58.7k
2 votes

Generic Dynamic Array Implementation

Stick to ISO C whenever possible: In your custom ASSERT(), you've used a compound statement expression, but that is only pertinent to one dialect of C, GNU C, and ...
Harith's user avatar
  • 9,462

Only top scored, non community-wiki answers of a minimum length are eligible