Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
856 B

  1. // scuCast.h -- Miscellaneous casting helpers
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #if !defined(SLBSCU_CAST_H)
  8. #define SLBSCU_CAST_H
  9. namespace scu
  10. {
  11. // Use are your own risk.
  12. template<class T, class E>
  13. T
  14. DownCast(E expr)
  15. {
  16. // For some reason, _CPPRTTI is defined when
  17. // in Microsoft's builds which causes access
  18. // violations later when runing, so it's commented
  19. // out.
  20. //#if defined(_CPPRTTI)
  21. //#error Compiling with RTTI turned on.
  22. // return dynamic_cast<T>(expr);
  23. //#else
  24. return static_cast<T>(expr);
  25. //#endif
  26. }
  27. } // namespace
  28. #endif // SLBSCU_CAST_H