What does second in the iterator do?

Updated on technology 2024-03-02
12 answers
  1. Anonymous users2024-02-06

    Iterator for the map container.

    There is first() and second(), where second is the value and is used to return data.

    For example: mapm;

    m["one"] = 1;

    map::iterator p = ;

    p->first;This is the string value is"one"

    p->second;This is int and the value is 1

    std::map actually stores a string of std::p air, std::mapm = * fill it * ; 、auto it = ;

    Here, if you use *it, then you will get the std::p air of the first element of the map, and now you can receive the two elements of std::p air:

    it).first will get the key, (*it).second gets the value, which is equivalent to it->first and it->second.

  2. Anonymous users2024-02-05

    The iterator of the map container in C++ has a first and a second in iterators

    For example. mapm;

    m["one"] = 1;

    map::iterator p = ;

    p->first;This is the string value is"one"

    p->second;This is int and the value is 1

  3. Anonymous users2024-02-04

    Is std::map's iterator?The element in the map is std::

    pair, use first to access std: :p the first member of the air (type1), and second to access the second member (type2).

  4. Anonymous users2024-02-03

    Here output all string strings with key values of xiaozhu, it first is the iterator pointing to the key value, and it second is the iterator pointing to the corresponding value!

  5. Anonymous users2024-02-02

    The iterator of the map container in C++ has a first and second, such as map m; m["one"] = 1; map::iterator p = ; p->first;This is the string value is"one" p->second;This is int and the value is 1

  6. Anonymous users2024-02-01

    Here output all string strings with key values of xiaozhu, it first is the iterator pointing to the key value, and it second is the iterator pointing to the corresponding value!

  7. Anonymous users2024-01-31

    Note that the element type of map multimap unordered map is std::p air. The first member of the element is the key, and the second member is the value.

  8. Anonymous users2024-01-30

    set's insert version function with a key argument returns a pair type object that contains an iterator.

    and a bool value, where the iterator points to the element that owns the key, and the bool value indicates whether the element was added.

    The second is the bool value in the returned pair.

  9. Anonymous users2024-01-29

    Is this what your cpoints look like?

    class point

    class cpoints

    it_point->

    This means the value of member z pointing to the second point.

  10. Anonymous users2024-01-28

    The C++ Iterator is a bit like a pointer, and the Cpoints should be a container for structs, so there is.

  11. Anonymous users2024-01-27

    it point->.

    The it point is an iterator, which can be understood as accessing the pointer second is the data in the node, which should literally be a class or struct

    z is a data in second.

  12. Anonymous users2024-01-26

    This is not how the map container fetches members.

    To give you an example:

    mapm;m["one"] = 1;

    map::iterator p = ;

    p->first;This is the string value is"one"

    p->second;This is int and the value is 1

Related questions
4 answers2024-03-02

I would like to ask this question as well.

7 answers2024-03-02

+ Follow the right binding rule;

a=++i++;Equivalent to int temp=i++, a=++temp; >>>More

6 answers2024-03-02

The more primitive ones are: lime-soda ash softening method, which is not used much. >>>More

12 answers2024-03-02

The circle is turned into a standard equation, the center of the circle and the radius r are obtained, and the distance d from the center of the circle to the straight line is obtained. Compare the magnitude of d and r to obtain three positional relationships between a straight line and a circle. >>>More

12 answers2024-03-02

sweetie [Concise English-Chinese Dictionary].

5swi:ti] >>>More