How does C ++ know that a container class has a push_back function?

When I look at std::back_insert_iterator http://en.cppreference.com/w/cpp/iterator/back_insert_iterator

It says that the container's push_back method will be called. How do I know if a container has a push_back method? Is a class that extends any virtual class required, and where is it defined?

+4
source share
7 answers

How do I know if a container has a push_back method?

This is not true. You will get a compilation error if you try to use it in a container that does not push_back.

Is a class that extends any virtual class required, and where is it defined?

, , . , ; , , (, container.push_back(thing)), .

+4

, push_back . , push_back? , ?

, push_back() .

std::back_insert_iterator - , push_back() . , .

+5

, . , โ€‹โ€‹.

( ), push_back, push_back, , .

+4

( ), , , . , , ...

+2

, . push_back std::back_insert_iterator. .

, set, :

'class std:: set' 'push_back'

+1

, .

std::back_insert_iterator ; , , , , .

, , , ( ) - , ( ) .

+1

.

. push_back . push_back, .

+1

All Articles