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

발아 바라 프로그래밍

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

발아 바라 프로그래밍

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

constexpr (1)
[Effective Modern C++] 항목 15. 가능하면 항상 constexpr을 사용하라

constexpr 은 객체에 적용했을때는 const 가 되며, 이 값은 컴파일 시점에 알려진다. 컴파일 시점에 알려지는 값들은 읽기 전용 메모리에 배치될 수 있다. 또 다른 장점으로는 컴파일 시점에 정수 상수 표현식이 요구되는 문맥에서 사용할 수 있다는 것이다. 어떤 경우에 사용할 수 있는지 예제를 통해 알아보자. int sz; // 비 constexpr 변수 ... constexpr auto arraySize1 = sz; // error std::array data1; // error constexpr auto arraySize2 = 10; // 10은 상수 std::array data2; // arraySize2는 constexpr 객체 여기서 알아야할것은 constexpr 이 아닌 const 로 선..

C++/Effective Modern C++ 2019. 10. 29. 00:07
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • Perfect
  • 다이소
  • detach
  • C
  • 보편 참조
  • Effective
  • forward
  • Unreal
  • Forwarding
  • C++14
  • thread
  • 발아시기
  • Override
  • std::forward
  • Modern
  • std::move
  • 보편참조
  • C++11
  • Join
  • C++
  • auto
  • MOVE
  • Effective Modern C++
  • Future
  • Overloading
  • async
  • CPP
  • 람다
  • 포인터
  • const
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

티스토리툴바