acl/lib_acl_cpp/include/acl_cpp/stdlib/final_tpl.hpp

57 lines
1.0 KiB
C++
Raw Normal View History

2014-11-19 00:25:21 +08:00
#pragma once
#include "acl_cpp/acl_cpp_define.hpp"
namespace acl {
#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() {}
};
}