-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtypedef.cpp
More file actions
executable file
·38 lines (23 loc) · 865 Bytes
/
typedef.cpp
File metadata and controls
executable file
·38 lines (23 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
// TODO
// FIXME
// https://cs.nyu.edu/courses/spring12/CSCI-GA.3033-014/Assignment1/function_pointers.html
/*
There are two ways of declaring new type aliases in modern C++. The first and
traditional one is with the typedef keyword:
1)typedef [original-type] [your-alias];
typedef int Pixel;
typedef std::map<std::string, std::vector<std::string>> Map;
2)The other one, introduced in C++11, is with the using keyword (using works
best with templates): using [your-alias] = [original-type];
using Pixel = int;
using Map = std::map<std::string, std::vector<std::string>>;
template <typename T> using Matrix= std::vector<std::vector<T>> ;
typedef void (*Something)()
To make it a function that takes no arguments (in C), you'd use:
typedef void (*MCB)(void);
In C++:
typedef void (*MCB)();
*/
typedef void (*MCB)();
int main() {}