Thursday, December 19, 2013

FeedaMail: Comments for Sutter̢۪s Mill

feedamail.com Comments for Sutter's Mill

Comment on GotW #90 Solution: Factories by Fahiem Bacchus

self documentation vs auto.
In example 2.

  unique_ptr<widget> load_widget( widget::id desired );  

You get self documentation—you can see in the code that you get control over widget.

Once you use auto

  // Accept as a unique_ptr (by default)  auto up = load_widget(1);  

we have to look up the signature of load_widget…it is no longer documented in the call.

This seems to be a subtle trade off here. Any thoughts?

Read More »
 
Delievered to you by Feedamail.
Unsubscribe