2011-12-14 00:35:28 +03:00
|
|
|
#pragma once
|
|
|
|
|
2011-12-17 21:59:59 +03:00
|
|
|
#include "../Global.h"
|
2011-12-14 00:35:28 +03:00
|
|
|
|
2012-03-27 23:08:54 +03:00
|
|
|
#include <boost/crc.hpp>
|
|
|
|
#include <boost/date_time/posix_time/posix_time_types.hpp> //no i/o just types
|
|
|
|
#include <boost/random/linear_congruential.hpp>
|
|
|
|
#include <boost/random/mersenne_twister.hpp>
|
|
|
|
#include <boost/random/variate_generator.hpp>
|
|
|
|
#include <boost/system/system_error.hpp>
|
2015-10-28 22:53:44 +02:00
|
|
|
|
|
|
|
template<class T, class F>
|
|
|
|
inline const T * dynamic_ptr_cast(const F * ptr)
|
|
|
|
{
|
|
|
|
#ifndef __APPLE__
|
|
|
|
return dynamic_cast<const T*>(ptr);
|
|
|
|
#else
|
|
|
|
if (!strcmp(typeid(*ptr).name(), typeid(T).name()))
|
|
|
|
{
|
|
|
|
return static_cast<const T*>(ptr);
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
|
|
|
}
|
2015-10-31 17:04:06 +02:00
|
|
|
|
|
|
|
template<class T, class F>
|
|
|
|
inline T * dynamic_ptr_cast(F * ptr)
|
|
|
|
{
|
|
|
|
#ifndef __APPLE__
|
|
|
|
return dynamic_cast<T*>(ptr);
|
|
|
|
#else
|
|
|
|
if (!strcmp(typeid(*ptr).name(), typeid(T).name()))
|
|
|
|
{
|
|
|
|
return static_cast<T*>(ptr);
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
|
|
|
}
|