Skip to main content
23 events
when toggle format what by license comment
May 30, 2023 at 15:31 history edited Levi Morrison CC BY-SA 4.0
Updated for C++23
Sep 29, 2018 at 14:49 history edited Levi Morrison CC BY-SA 4.0
Add missing comma.
Sep 29, 2018 at 6:12 comment added Arash typo: using grid = std::array<std::array<int, sizeX> sizeY>; is missing a comma before sizeY.
Aug 1, 2018 at 12:26 comment added Levi Morrison Also, @KcFnMi, if you decide to use kamshi's answer then be sure to read Ben's comment about using make_unique instead of new/delete.
Aug 1, 2018 at 12:23 comment added Levi Morrison They are fairly comparable with respect to the underlying technique: there is a single array that holds all values in all dimensions. Then, somehow return pointers to the beginning of each row. In practice the class will usually have more useful methods, possibly have copy constructor and copy assignment operators, have asserts for debug builds to verify memory accesses, etc. These additions generally make it easier and nicer to work with.
Aug 1, 2018 at 2:23 comment added KcFnMi May I say this is a sophisticated/modern answer with underneath philosophy very similar to (simpler, in terms of LOC and concepts) answer given by @kamshi?
May 15, 2018 at 15:26 history edited Levi Morrison CC BY-SA 4.0
Tweak clang-format
May 15, 2018 at 14:59 history edited Levi Morrison CC BY-SA 4.0
Format using clang-format
Oct 23, 2017 at 16:29 history edited Levi Morrison CC BY-SA 3.0
Add `operator()`
Oct 14, 2017 at 16:04 history edited Levi Morrison CC BY-SA 3.0
Fix rows and columns.
Sep 14, 2017 at 14:47 history edited Levi Morrison CC BY-SA 3.0
note that `make_unique` is part of C++14
Jun 13, 2017 at 13:19 comment added Levi Morrison If you know the dimensions at compile time (which you do if you are using template parameters) then I recommend using a std::array of std::arrays: std::array<std::array<int, columns> rows>.
Jun 12, 2017 at 15:15 comment added Janus Troelsen would it be possible to make the rows and columns template parameters?
Apr 25, 2017 at 14:42 history edited Levi Morrison CC BY-SA 3.0
Describe image.
Nov 21, 2016 at 16:37 history edited Levi Morrison CC BY-SA 3.0
Change formatting so it fits without scrolling on smaller screens or larger fonts.
Jun 10, 2016 at 13:28 history edited Levi Morrison CC BY-SA 3.0
Inline constructor as VS has issues with it.
Feb 1, 2016 at 17:33 history edited Levi Morrison CC BY-SA 3.0
Use C++11 brace initialization
Oct 17, 2015 at 15:47 history edited Levi Morrison CC BY-SA 3.0
Remove const
Sep 30, 2015 at 0:04 history edited Levi Morrison CC BY-SA 3.0
Explain simplified class a bit more (was sort of removed by previous edit)
Sep 16, 2015 at 14:22 history edited Levi Morrison CC BY-SA 3.0
Return by const reference (helpful in some situations)
Sep 12, 2015 at 13:54 history edited Levi Morrison CC BY-SA 3.0
Clarify some assumptions.; added 3 characters in body
Aug 28, 2015 at 20:58 history edited Levi Morrison CC BY-SA 3.0
Expanded explanations.
Aug 28, 2015 at 20:44 history answered Levi Morrison CC BY-SA 3.0