Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,27 @@ N::T t; // Use name T in namespace N
using namespace N; // Make T visible without N::
```

## TypeDef
Used For Aliasing

```cpp
typedef std::vector<int> vInt; //typedef <current_name> <new_name>
```
Now in code we can call vInt if we want to make a Vector of int type
```cpp
vInt v;

v.push_back(190);
v.push_back(180);
v.push_back(10);
v.push_back(10);
v.push_back(27);

for (auto X : v) {
cout << X << " ";
}
```

## `memory` (dynamic memory management)

```cpp
Expand Down
16 changes: 16 additions & 0 deletions cheatsheet-as-sourcefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,22 @@ namespace N {class T {};} // Hide name T
N::T t; // Use name T in namespace N
using namespace N; // Make T visible without N::

// ## TypeDef


typedef std::vector<int> vInt; //typedef <current_name> <new_name>
vInt v;

v.push_back(190);
v.push_back(180);
v.push_back(10);
v.push_back(10);
v.push_back(27);

for (auto X : v) {
cout << X << " ";
}

// ## `memory` (dynamic memory management)

#include <memory> // Include memory (std namespace)
Expand Down