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

발아 바라 프로그래밍

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

발아 바라 프로그래밍

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

Lambda (1)
[Effective Modern C++] 항목 33. std::forward를 통해서 전달할 auto&& 매개변수에는 decltype을 사용하라

람다 함수와 함께 auto 를 사용하는 것은 매우 고무적인 일이다. 다음과 같이 말이다. auto f = [](auto x) { return normalize(x); }; 이 람다 함수는 컴파일러에 의해 다음과 같은 클로저 클래스가 생성된다. class 컴파일러가_생성한_클래스 { public: template auto operator()(T x) const { return normalize(x); } ... }; 이제 문제가 생기는 것은 x 를 normalize 에 완벽 전달을 하고 싶어지면 어떻게 해야할까? auto f = [](auto&& x) { return normalize(std::forward(x)); }; ???에 적어야할 타입은 무엇일까? 우리는 항목3에서 배운 decltype 을 사용하..

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

티스토리툴바