开发者

interface of the list in c++

开发者 https://www.devze.com 2023-01-19 01:11 出处:网络
I found some interface for the list:开发者_运维问答 and there I found this constructor template<typenameT>

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号