Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 7
    [Pro Tip] Use std::array in place of raw arrays. It actually has value semantics unlike a raw array. Commented Jan 17, 2020 at 16:13
  • Edited post, to reflect the fact, that I cannot use anything from STL due to project restrictions. Otherwise i would have used array myself. Commented Jan 17, 2020 at 16:34
  • 1
    Then that is a bad project. Commented Jan 17, 2020 at 16:39
  • 2
    std::array is fairly trivial to implement yourself. Depending on all the functionality you want, it can be as simple as template <typename T, std::size_t N> struct my_array { T data[N]; }; Commented Jan 17, 2020 at 16:40
  • 1
    If you need to create a std::make_index_sequence like, take in count that my answer in the cited question is good to give a simple description of a possible implementation but isn't a good implementation (it's linear, so you break the template recursion limit with low numbers; better a logarithmic implementation). Commented Jan 20, 2020 at 9:57