Three Meanings of Reference
sandordargo.com·14w·
Discuss: Hacker News, r/cpp

Conferences are a great source of inspiration, partly trought talks and partly trough the best track, the hallway track. I already mentioned that at CppCon one of my favourite talks was the one by Steve Downey on std::optional<T&>. He also mentioned that there are three different uses of references in C++. I was thinking whether it’s four and disucssed this the next day during the break between two talks.

Let’s talk about the 3 usages and I’ll give you the extra one which is not a usage of references but what I was thinking about originally.

Calling Conventions

One of the most common uses of references are function parameters. We often pass arguments by reference to avoid unnecessary c…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help