logoalt Hacker News

gpderettalast Monday at 1:12 PM2 repliesview on HN

In what way it is a footgun? auto x = ... ; does what I would expect. Copying is usually the default in C++ and that's what I would expect to happen here.

If auto deduced reference types transparently, it would actually be more dangerous.


Replies

tialaramexlast Monday at 4:09 PM

Copying is a weird default because who said that's even achievable, let alone cheap?

So I guess I depart from you there and thus my issue here is not really about auto

show 1 reply
spacechild1last Monday at 1:34 PM

That's exactly what I was about to write!