Quantcast
Channel: What is the difference between default arguments and function overloads? - Stack Overflow
Browsing all 5 articles
Browse latest View live

Answer by anderas for What is the difference between default arguments and...

While the design choices of the other answers are all valid, they do assume one thing that does not fully apply here: Semantic equivalence!void shared_ptr::reset() noexcept; // ^^^^^^^^template...

View Article



Answer by Christophe for What is the difference between default arguments and...

There is a fundamental difference between an overload and a default pointer:the overload is self contained: the code in the library is completely independent of the calling context.the default...

View Article

Answer by StoryTeller - Unslander Monica for What is the difference between...

The crucial difference, is that the two operations are in fact not semantically the same.The first is meant the leave the shared_ptr without a managed object. The second is meant to have the pointer...

View Article

Answer by Mats Petersson for What is the difference between default arguments...

If you are OFTEN resetting to precisely nullptr rather than a new value, then the separate function void shared_ptr::reset() noexcept; will have a space advantage, since you can use the one function...

View Article

What is the difference between default arguments and function overloads?

For example, instead ofvoid shared_ptr::reset() noexcept;template <typename Y>void shared_ptr::reset(Y* ptr);one may think oftemplate <typename Y = T>void shared_ptr::reset(Y* ptr =...

View Article

Browsing all 5 articles
Browse latest View live




Latest Images