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

57 lines
1.1 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
2014-11-19 00:25:21 +08:00
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
/*
* ,final_tpl派生,
*
2014-11-19 00:25:21 +08:00
* @example:
* class my_final_class : public acl::final_tpl <my_final_class>
* {
* public:
* my_final_class() {}
* ~my_final_class() {}
* }
* my_final_class
2014-11-19 00:25:21 +08:00
*/
template<typename TFinalClass>
class final_tpl : virtual public final_tpl_base<TFinalClass,
final_tpl<TFinalClass> >
{
public:
final_tpl() {}
~final_tpl() {}
};
}