Home c++ Is it possible to withdraw the iterator from Std :: String? C++

Is it possible to withdraw the iterator from Std :: String? C++

Author

Date

Category

Let’s say I go through the line through the cycle with iterators. How do I disable a string symbol corresponding to this cycle iteration? STD :: COUT & LT; & LT; STR [i] & lt; & lt; “\ n”; does not work.
Code:

for (auto i = str.begin (); i! = str.end (); i ++) {
  // Here it is necessary to display the symbol in this iteration of the cycle
}

Answer 1, Authority 100%

for (auto i = str.begin (); i! = str.end (); i ++) {
  COUT & LT; & LT; * i;
}

That’s all 🙂 The iterator is an analogue of a pointer, which, when specifying with * , gives what indicates.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions