nakka soft world !

using (template alias) 본문

프로그래밍언어/C++

using (template alias)

nakka 2017. 3. 9. 21:33
728x90

C++11/14


C Style

typedef int DWORD;

typedef void(*PF)();

- 타입의 별명을 만들 수 있음



using DWORD = int;

using PF = void(*)();

-타입의 별명과 템플릿의 별명을 만들수 있기에 typedef보다 좋음


int main(){

DWORD n = 0; // int

PF f; //함수 포인터

}

728x90

'프로그래밍언어 > C++' 카테고리의 다른 글

Function Overloading  (0) 2017.03.14
default parameter  (0) 2017.03.14
ranged for  (0) 2017.03.09
nullptr  (0) 2017.03.09
Auto / decltype  (0) 2017.03.09
Comments