Request Short Link
C++ 98
C++ 11
C++ 14
C++ 17
C++ 20
C++ 23
C++ 2c
for-loops as while-loops
array subscription
Show all implicit casts
Show all template parameters of a CallExpr
Use libc++
Transform std::initializer_list
Show noexcept internals
Show padding information
Show coroutine transformation
Show C++ to C transformation
Show object lifetime
Default
15
18
20
22
26
More
GitHub
Patreon
Patreon
Issues
About
Policies
Examples
C++ Insights @ YouTube
Settings
Version
Join now: C++ Self Study + 1:1 Coaching
×
Sponsors:
Made by
Andreas Fertig
Source:
#include <iostream> using namespace std; struct S { int x = 0; S() { cout << "S: " << this << endl; } ~S() { cout << "~S: " << this << endl; } }; // Why does f() call ~S()? void f(S const& s) { auto [x] {s}; cout << "f: " << x << endl; } void g(S const& s) { auto& [x] {s}; cout << "g: " << x << endl; } void h(S const& s) { auto x = s.x; cout << "h: " << x << endl; } int main(int, char**) { S s; f(s); g(s); h(s); }
Insight:
Console: