본문 바로가기 메뉴 바로가기

발아 바라 프로그래밍

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

발아 바라 프로그래밍

검색하기 폼
  • 분류 전체보기 (56)
    • Unreal Engine 4 (4)
    • C++ (45)
      • Effective Modern C++ (40)
    • 프로그래밍 (3)
    • 식물기르기 (2)
    • 티스토리 (1)
  • 방명록

decltype (1)
[Effective Modern C++] 항목 3. decltype의 작동 방식을 숙지하라

decltype 이라는 키워드는 객체가 주어졌을때, 그 객체의 타입을 알려준다. 예시를 보자. const int i = 0; // decltype(i)는 const int MyClass object; // decltype(object)는 MyClass 위와 같이 객체의 타입을 알려주는데, 가끔 생각한대로 동작하지 않는 경우가 있다. 특이한 작동 방식 먼저 코드를 보자. template auto authAndAccess(Container& c, Index i) -> decltype(c[i]) { authenticateUser(); return c[i]; } 위에서 보이는 함수처럼 auto 와 decltype 을 이용한 방식을 후행 반환 형식이라고 한다. 후행 반환 형식으로 선언한 함수의 반환 타입은 dec..

C++/Effective Modern C++ 2019. 9. 2. 21:19
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • Override
  • Overloading
  • Unreal
  • Effective Modern C++
  • forward
  • async
  • C++14
  • thread
  • Future
  • const
  • C++11
  • C++
  • Effective
  • std::forward
  • 포인터
  • MOVE
  • 보편참조
  • Perfect
  • detach
  • Modern
  • 보편 참조
  • std::move
  • 발아시기
  • 람다
  • auto
  • 다이소
  • CPP
  • Forwarding
  • Join
  • C
more
«   2026/01   »
일 월 화 수 목 금 토
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
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바