'2008/10/23'에 해당되는 글 2건

  1. C++-style casts 2008/10/23
  2. 투덜이의 일상 - 2008년 10월 22일 2008/10/23

C++-style casts

from Programming/C&CPP 2008/10/23 16:15

const_cast<T>(expression)

dynamic_cast<T>(expression)

reinterpret_cast<T>(expression)

static_cast<T>(expression)

  • const_cast is typically used to cast away the constness of objects. It is the only C++-style cast that can do this.
  • dynamic_cast is primarily used to perform "safe downcasting," i.e., to determine whether an object is of a particular type in an inheritance hierarchy. It is the only cast that cannot be performed using the old-style syntax. It is also the only cast that may have a significant runtime cost.
  • reinterpret_cast is intended for low-level casts that yeld implementation-dependent (i.e., unportable) results, e.g., casting a pointer to an int. Such casts should be rare outside low-level code.
  • static_cast can be used to force implicit conversions (e.g., non-const object to const object, int to double, etc.). It can also be used to perform the reverse of many such conversions (e.e., void * pointers to typed pointers, pointer-to-base to pointer-to-derived), though it cannot cast from const to non-const objects. (Only const_cast can do that.)

출처: Effective C++, Third Edition

2008/10/23 16:15 2008/10/23 16:15
Tag //
  • 세계 경제 불황으로 인해 미국 가는 프로젝이 최소 비용으로 진행하는 것으로 결론 났다. 비용이 많이 드는 출장이나 추가 비용을 발생시키는 사내이동은 금지됐다.(손해가 도대체 얼마야...ㅡ.ㅡ;;)2008-10-17 12:39:56
  • 6개월 미국 출장이 1개월만에 끝나는 바람에 이제 전세를 다시 구해야 한다.(최근 전세가격 동향이 어떠했을까나?)2008-10-17 12:40:51
  • 오늘 2주만에 아이를 보러 진해에 간다~(벌써 보고싶다~)2008-10-17 17:07:47
  • 운전이란 게 참 피곤한 거구나. 진해에 내려가서 운전만 하면 아침에 일어나질 못하겠다. 2주마다 한 번씩 운전을 해서 그런건가?(그래도 재미는 있다.)2008-10-21 20:31:20
  • 아침 일찍 출근하긴 하는데… 피곤하다.(이런 말을 입에 달고 살면 안되는데...)2008-10-22 10:04:22

이 글은 oosoom님의 2008년 10월 17일에서 2008년 10월 22일까지의 미투데이 내용입니다.

2008/10/23 04:32 2008/10/23 04:32