Automatically Made Weak -- Brett Hall

A nice nugget about a handy make_weak one-liner:

Automatically Made Weak

by Brett Hall

From the article:

I’ve been experimenting with the new “auto everything” style in C++. I also make regular use of std::weak_ptr... [and wouldn't it be nice if] we can just type

auto weak = make_weak(shared);

Add a Comment

Comments are closed.

Comments (2)

0 0

NoSenseEtAl said on Nov 15, 2013 05:41 PM:

in my humble programming experience more often I need to try to get shared_ptr from weak, so maybe auto sp = try_shared(wp) would be nice
0 0

NoSenseEtAl said on Nov 18, 2013 06:59 AM:

@Herb
Doh. smile Thank you...
P.S. comments are not working on your site.
Your comment is awaiting moderation. //For days