简体   繁体   中英

While using min_element in c++ the second range is not included

min_element(vec.begin()+3,vec.begin()+5)

这里的vec.begin+3是包含的,但不包含vec.begin+5如何使它包含在内?

min_element(vec.begin()+3,vec.begin()+5)

Here vec.begin+3 and vec.begin+5 are not inclusive how do i make them inclusive?

That's not correct.

vec.begin()+3 is inclusive.

To make vec.begin()+5 inclusive, use vec.begin()+6 as the second argument.

min_element(vec.begin()+3, vec.begin()+6) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM