What’s the difference between std::advance and std::next?

std::advance

  • modifies its argument
  • returns nothing
  • works on input iterators or better (or bi-directional iterators if a negative distance is given)

std::next

  • leaves its argument unmodified
  • returns a copy of the argument, advanced by the specified amount
  • works on forward iterators or better (or bi-directional iterators if a negative distance is given))

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)