How to make a range to use range based for (to replace traditional for)? [duplicate]

Clash Royale CLAN TAG#URR8PPP
How to make a range to use range based for (to replace traditional for)? [duplicate]
This question already has an answer here:
I have the following loop in more then one place:
for(int step = 1; step < timesteps; step++) ...
Then I had to change timesteps to start at 0. And I have to change it in more then one place.
May I take advantage of range based for loops in this situation? So may be I can write just
for(auto &step : timesteps) ...
In that case what kind of timesteps should be used? std::vector timesteps?
Before I forget to mention, timesteps is just an int i.e. int timesteps = 10;. Unknown at compile time, the user will define it.
int timesteps = 10;
p.s.: stl is preferred over boost.
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
timesteps
Use your favourite range library, e.g. Boost.Range:
for(auto step : boost::irange(1, timesteps)) Live on Wandbox– Henri Menke
Aug 6 at 3:14
for(auto step : boost::irange(1, timesteps))
If
timesteps is just an integer value, you can't use a range based for. There is no range in a single integer -- it is what it is and nothing more. (poet and didn't know it...) Technically, there is no begin or end for a single-integer.– David C. Rankin
Aug 6 at 3:24
timesteps
begin
end
You mean there is no similar to irange of boost in stl so far?
– KcFnMi
Aug 6 at 3:29
Related: codereview.stackexchange.com/questions/51523/… stackoverflow.com/questions/7185437/… stackoverflow.com/questions/4930096/…
– Jerry Jeremiah
Aug 6 at 3:36
what is the declaration of
timesteps?– Steephen
Aug 6 at 3:11