Three Meanings of Reference
sandordargo.com·20h·
Discuss: Hacker News, r/cpp
Flag this post

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...