Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Why does std::vector have 2 constructors instead of 1 with default arguement?

$
0
0

I looked at cppreference.com and found this

vector();explicit vector( const Allocator& alloc );

why not just

explicit vector(const Allocator& alloc = Allocator());

1 constructor instead of 2.Is there a reason for this? same with resize(std::size_t,const T& t) andresize(std::size_t)why not just resize(std::size_t,const T& t = T())


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>