https://www.learncpp.com/cpp-tutorial/typedefs-and-type-aliases/
alias (별칭, 별명)
c++에서는 using keyword를 이용해 type alias를 설정할 수 있다
using distance_type = double; // Also ok, more about this in a later chapter
using distance = double; // Also ok, but could be confused for- and collide with variable names
typedef또한 별칭을 지어주는 위의 효과와 똑같은 역할을 하는 키워드 이다
예시는 다음과 같다
// The following aliases are identical
typedef long miles_t;
using miles_t = long;
주의
typedef의 경우 type이 먼저 alias가 나중에 온다는 것을 명심하자!!
이러한 type alias를 생성하는 기능을 이용해
복잡한 type을 간단하게 사용할 수 있다
예를 들어
using pairlist_t = std::vector<std::pair<std::string, int>>;
위와 같이 말이다
legibility : 읽기 쉬움
alias를 이용해서 우리는 가독성을 높일 수도 있다
using testScore_t = int;
testScore_t gradeTest();
이러한 이점이 있지만 혼동이 생길 수 있으므로
정말 사용했을 때 이점이 뚜렷한 경우 사용하길 바란다