How to create new std::list from existing std::list taking first n-5 elements ?
n is size of existing list (list)
How to create new std::list from existing std::list taking first n-5 elements ? n
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.
where
Tis the value type of the old list.std::previs new in C++11, but if you don’t have it you can usestd::advanceinstead:Either way it’s your responsibility to ensure that
oldlist.size() >= 5. Neitherstd::prevnorstd::advancedoes that for you.