>>
and <<
These double angle-brackets are either:
- Iostreams: “Put-to” (
<<
) or “get-from” (>>
) - Numbers: Bit-wise left shift (
<<
) and right shift (>>
)
Indirection operator
The indirection, or dereference, operator is the asterisk (*
).
#include<iostream>
int foo() {
int a = 5;
int* b = &a;
return *b;
}
int main() {
std::cout << foo();
}
Address-of operator
The address-of operator is ampersand (&
).
#include<iostream>
int foo() {
int a = 5;
int* b = &a;
return *b;
}
int main() {
std::cout << foo();
}
Scope resolution operator
The scope resolution operator is ::
.
Structured binding
Structured binding uses auto
and []
:
struct Cat {
int weight_in_lbs;
int age;
};
Cat Foo() { ... }
auto [weight, age] = Foo();