tags:

views:

42

answers:

1

hello everyone, I found some interface for the list: and there I found this constructor

template<typenameT>
...

list(size_tnum, constT& val = T());
...

can somebody explain what is this: constT& val = T()

thanks in advance

+4  A: 

const T& val = T()

This describes a parameter that is taken by const reference, but is optional because the parameter is declared with an initialier. If not supplied then a value initialized temporary (T()) is used.

The list constructor you've found initializes a list with num copies of the val parameter.

Charles Bailey