StdInc.h 868 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "../Global.h"
  3. #include <boost/crc.hpp>
  4. #include <boost/date_time/posix_time/posix_time_types.hpp> //no i/o just types
  5. #include <boost/random/linear_congruential.hpp>
  6. #include <boost/random/mersenne_twister.hpp>
  7. #include <boost/random/variate_generator.hpp>
  8. #include <boost/system/system_error.hpp>
  9. template<class T, class F>
  10. inline const T * dynamic_ptr_cast(const F * ptr)
  11. {
  12. #ifndef __APPLE__
  13. return dynamic_cast<const T*>(ptr);
  14. #else
  15. if (!strcmp(typeid(*ptr).name(), typeid(T).name()))
  16. {
  17. return static_cast<const T*>(ptr);
  18. }
  19. return nullptr;
  20. #endif
  21. }
  22. template<class T, class F>
  23. inline T * dynamic_ptr_cast(F * ptr)
  24. {
  25. #ifndef __APPLE__
  26. return dynamic_cast<T*>(ptr);
  27. #else
  28. if (!strcmp(typeid(*ptr).name(), typeid(T).name()))
  29. {
  30. return static_cast<T*>(ptr);
  31. }
  32. return nullptr;
  33. #endif
  34. }