0

is there a Python range() function equivalent in C++? So for example if I type range(5), it should return an array of {0, 1, 2, 3, 4}.

My goal is to initialize an array based on a number, like

uint32_t newArray[num_size] = range(num_size);
A1122
  • 1,158
  • 2
  • 11
  • 26
  • 1
    One might be able to cook something up with templates. I did something like that to generate a base64-decoding lookup table at compile time. However: C++ is not Python. Attempting to translate Python to C++ (or the other way around), line by line. The correct way to translate code from one language to another (if that's what's happening here) is to analyze each discrete part of the original program, then rewrite it in the other language. – Sam Varshavchik Jul 04 '21 at 14:05

0 Answers0