본문 바로가기
프로그래밍 언어/C++

C++ 문법 / Using 키워드

by Nighthom 2023. 2. 13.
// 1. 타입 별명
using DWORD = int;
using fp = void(*)(int);

// 2. 템플릿 별명
template<typename T>
class Point {
    T x, y;
};
template<typename T>
using PT = Point<T>; 

// 3. 템플릿 인자 고정
template<typename T, typename U>
using duo = pair<T, U>;
template<typename T>
using int_duo = pair<int, T>;

// 4. 복잡한 문법 단순화
template<typename T>
using remove_pointer_t = typename remove_pointer<T>::type;

 

댓글