2014-11-19 00:25:21 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
2015-06-28 20:27:51 +08:00
|
|
|
|
#if defined(WIN32) || defined(WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
template<typename TDerive, typename TProvider>
|
|
|
|
|
class final_tpl_base
|
|
|
|
|
{
|
|
|
|
|
friend TDerive;
|
|
|
|
|
friend TProvider;
|
|
|
|
|
private:
|
|
|
|
|
final_tpl_base() {}
|
|
|
|
|
~final_tpl_base() {}
|
|
|
|
|
};
|
|
|
|
|
#else
|
|
|
|
|
template <typename T>
|
|
|
|
|
class identity
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
typedef T me;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename TDerive, typename TProvider>
|
|
|
|
|
class final_tpl_base
|
|
|
|
|
{
|
|
|
|
|
friend class identity<TDerive>::me;
|
|
|
|
|
friend class identity<TProvider>::me;
|
|
|
|
|
private:
|
|
|
|
|
final_tpl_base() {}
|
|
|
|
|
~final_tpl_base() {}
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* <EFBFBD>ṩ<EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>Ҫ<EFBFBD>˹<EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>final_tpl<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @example:
|
|
|
|
|
* class my_final_class : public acl::final_tpl <my_final_class>
|
|
|
|
|
* {
|
|
|
|
|
* public:
|
|
|
|
|
* my_final_class() {}
|
|
|
|
|
* ~my_final_class() {}
|
|
|
|
|
* }
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD>֤<EFBFBD><EFBFBD> my_final_class <EFBFBD>Dz<EFBFBD><EFBFBD>ܱ<EFBFBD><EFBFBD>̳е<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
template<typename TFinalClass>
|
|
|
|
|
class final_tpl : virtual public final_tpl_base<TFinalClass,
|
|
|
|
|
final_tpl<TFinalClass> >
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
final_tpl() {}
|
|
|
|
|
~final_tpl() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|