What’s the best way for setting an std::vector<int> to a range, e.g. all numbers between 3 and 16?
What’s the best way for setting an std::vector<int> to a range, e.g. all numbers
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use
std::iotaif you have C++11 support or are using the STL:or implement your own if not.
If you can use
boost, then a nice option isboost::irange: