samedi 19 janvier 2019

insert value into vector

At site cppreference, out of 5 different ways of inserting value(s) into a vector,

the first basic two(02) ways are as under.

(1)iterator insert( iterator pos, const T& value );

(2)iterator insert( const_iterator pos, T&& value );


Example of (1) is very widely used. It is:

v.insert(pos, val);

Here, pos is of type iterator and

val is of type const T&

Now I want an example of (2). How to use it?

Actually I have problem reading T& value and T&& value.

I don't have problem reading iterator pos or const_iterator pos

In iterator pos:

pos is of type iterator and

In const_iterator pos:

pos is of type const_iterator

How should I read T& value and T&& value ?

What do T& and T&& stand for ??

Aucun commentaire:

Enregistrer un commentaire