Open mhoemmen opened 2 years ago
I think that we may additionally add the .at()
method , like in std::vector, and, possibly, some kind of explicit bound checks method like item_in_range(Index... Idx)
I also may cook a proposal with this feature 😅
Both
default_accessor
andlayout_{left, right, stride}::mapping::operator()
have in-bounds access as a precondition. This permits implementations to add bounds checking, using whatever mechanism they like (as precondition violations are undefined behavior).<iostream>
. (The test and branch have a nonzero run-time cost. Also, code for printing error messages can costs compilation time and possibly also performance (e.g., extra registers in device code).)