亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? typetraits.h

?? 高級范型編程
?? H
字號:
// -*- C++ -*-

//##############################################################################
//The dnc Library
//Copyright (c) 2005 Dreamsoft 趙純華
//定義Type操作的基礎設施
//##############################################################################
//
//Last update: 2005-11-9

#ifndef __DNC_TYPETRAITS_H__
#define __DNC_TYPETRAITS_H__

/** If the compiler can implementation is_base<T> template,then has
 *  DNC_CANCHECKBASE define.
 */
#if !defined(__DMC__) && !defined(DNC_CANCHECKBASE)
#define DNC_CANCHECKBASE
#endif

namespace dnc{
    /**
     *  提供兩個尺寸不一樣的類型,用于sizeof操作符獲得不同的靜態(tài)整數
     */
    typedef char yes_type;
    struct no_type{
        char padding[8];
    };

    /**
     *  把整數或者一種類型轉換成另一種類型,把一個常數或者類型進行強化
     *  @code
     *      //根據整數重載函數
     *      void foo(int2type<0>){
     *      }
     *      void foo(int2type<1>){
     *      }
     *      //根據整數調用函數
     *      void test(){
     *          foo(int2type<0>()); //call foo(int2type<0>)
     *          foo(int2type<1>()); //call foo(int2type<1>)
     *      }
     *
     *      //根據類型重載函數,但是不為類型創(chuàng)建對象
     *      void foo(type2type<MyType>){
     *      }
     *      void foo(type2type<int>){
     *      }
     *      //根據類型調用函數,但是不創(chuàng)建這個類型的對象
     *      void test(){
     *          foo(type2type<MyType>()); //call foo(type2type<MyType>);
     *          foo(type2type<int>());    //call foo(type2type<int>);
     *      }
     *  @endcode
     */
    template <int v>    struct int2type{enum { value = v };};
    template <class T>  struct type2type{typedef T OriginalType;};

    /**
     *  類型選擇器,相當于一個三元運算符
     */
	template<bool flag>
	struct selector_helper{
		template<class T,class U>
		struct select{
			typedef T type;
		};
	};
	template<>
	struct selector_helper<false>{
		template<class T,class U>
		struct select{
			typedef U type;
		};
	};
	template <bool flag, typename T, typename U>
    struct selector{
		typedef typename selector_helper<flag>::template select<T,U>::type type;
	};


    /** cv_traits<T> const volatile traits.
     *  多數compiler不能對const和volatile修飾進行模板特化,但是能對被const和
     *  volatile修飾的指針進行特化,這樣其實通過簡單的轉化就能處理任意的類型,所以
     *  把這兩種情況放在一起處理.
     *  @param T any C++ type
     *  @return type 沒有經過const 和 volatile修飾的類型.
     *  @return is_const Bool value whether T is const.
     *  @return is_volatile Bool value whether T is volatile.
     */
    template <typename T> struct cv_traits{};

    template <typename T>
    struct cv_traits<T*>{
        enum{is_const = false,is_volatile = false};
        typedef T type;
    };

    template <typename T>
    struct cv_traits<const T*>{
        enum{is_const = true,is_volatile = false};
        typedef T type;
    };

    template <typename T>
    struct cv_traits<volatile T*>{
        enum{is_const = false,is_volatile = true};
        typedef T type;
    };

    template <typename T>
    struct cv_traits<const volatile T*>{
        enum{is_const = true,is_volatile = true};
        typedef T type;
    };
    
//------------------------------------------------------------------------------
//判斷是否是數組類型
//------------------------------------------------------------------------------
#if 0
	template< typename T > T(* is_array_tester1(type2type<T>) )(type2type<T>);
	char is_array_tester1(...);

	template< typename T> no_type is_array_tester2(T(*)(type2type<T>));
	yes_type is_array_tester2(...);

	template< typename T >
	struct is_array
	{ 
		enum {
			value = 
			sizeof(is_array_tester2(
					is_array_tester1(
					type2type<T>()
					)
			)) == 1
		};
	};
#else
	template<class T> struct is_array{enum{value=false};};
	template<class T> struct is_array<T[]>{enum{value=true};};
#ifndef __DMC__
	template<class T,int C> struct is_array<T[C]>{enum{value=true};};
#endif
    
#endif


    template <typename T> struct is_pointer{
        enum{value=false};
    };
    template <typename T> struct is_pointer<T*>{
        enum{value=true};
    };
    template <typename T> struct is_pointer<const T*>{
        enum{value=true};
    };
    template <typename T> struct is_reference{
        enum{value=false};
    };
    template <typename T> struct is_reference<T&>{
        enum{value=true};
    };
    template <typename T> struct is_reference<const T&>{
        enum{value=true};
    };
    /** template<class T> is_const;
     */
    template <typename T> struct is_const{
        enum{value=cv_traits<T>::is_const};
    };
    /** remove_reference<T>
     */
    template<class T> struct remove_reference{
        typedef T type;
    };
    template<class T> struct remove_reference<T&>{
        typedef T type;
    };
    template<class T> struct remove_pointer{
        typedef T type;
    };
    template<class T> struct remove_pointer<T*>{
        typedef T type;
    };
    template <typename T, bool is_vol>
    struct remove_const_helper{
        typedef T type;
    };

    template <typename T>
    struct remove_const_helper<T, true>{
        typedef T volatile type;
    };
    
    template <typename T>
    struct remove_const{
        typedef typename cv_traits<T*>::type unqualified_type;
        enum{is_volatile = cv_traits<T*>::is_volatile};
        typedef typename remove_const_helper<
                unqualified_type,is_volatile
            >::type type;
    };
//------------------------------------------------------------------------------
//is_integral 判斷是否是整數類型
//------------------------------------------------------------------------------
	template<class T> struct is_integral{enum{value=false};};

	template<> struct is_integral<unsigned char>{enum{value=true};};
	template<> struct is_integral<unsigned short>{enum{value=true};};
	template<> struct is_integral<unsigned int>{enum{value=true};};
	template<> struct is_integral<unsigned long>{enum{value=true};};
#ifdef DNC_HASLONGLONG
	template<> struct is_integral<unsigned long long>{enum{value=true};};
#endif
    template<> struct is_integral<signed char>{enum{value=true};};
	template<> struct is_integral<signed short>{enum{value=true};};
	template<> struct is_integral<signed int>{enum{value=true};};
	template<> struct is_integral<signed long>{enum{value=true};};
#ifdef DNC_HASLONGLONG
	template<> struct is_integral<long long>{enum{value=true};};
#endif
	template<> struct is_integral<bool>{enum{value=true};};
	template<> struct is_integral<char>{enum{value=true};};
#ifdef DNC_HASWCHAR
	template<> struct is_integral<wchar_t>{enum{value=true};};
#endif

//------------------------------------------------------------------------------
//is_float 判斷是否是浮點數類型
//------------------------------------------------------------------------------
	template<class T> struct is_float{enum{value=false};};
	template<> struct is_float<float>{enum{value=true};};
	template<> struct is_float<double>{enum{value=true};};
	template<> struct is_float<long double>{enum{value=true};};

//------------------------------------------------------------------------------
//判斷是否是算數類型
//------------------------------------------------------------------------------
	template<class T> struct is_arithmetic
	{enum{value=is_integral<T>::value||is_float<T>::value};};



//------------------------------------------------------------------------------
//判斷是否是void類型
//------------------------------------------------------------------------------
	template<typename T> struct is_void{enum{value=false};};
	template<> struct is_void<void> {enum{value=true};};

//------------------------------------------------------------------------------
//判斷是否是class或者union或者struct
//------------------------------------------------------------------------------
	template <typename T>
	struct is_class{
        template <class U> static yes_type is_class_or_union_tester(void(U::*)(void));
		template <class U> static no_type  is_class_or_union_tester(...);
		enum{value = sizeof(is_class_or_union_tester<T>(0)) == sizeof(yes_type)};
	};

//------------------------------------------------------------------------------
//判斷From是否能轉換成To
//------------------------------------------------------------------------------
	template <class From, class To>
    struct is_convertible{
	private:
		static no_type	is_convertible_tester(...);
		static yes_type is_convertible_tester(To);
	public:
		enum{value = sizeof(is_convertible_tester(From())) == sizeof(yes_type)};
	};
//------------------------------------------------------------------------------
//判斷T和U是否是同一種類型
//------------------------------------------------------------------------------
	template <class T, class U>
	struct is_same{
	private:
		static yes_type is_same_tester(T**, T**);
		static no_type  is_same_tester(...);
	public:
		enum{value = 
			sizeof(yes_type) == sizeof(is_same_tester((T**)0,(U**)0)) && 
			sizeof(T) == sizeof(U)
		};
	};
//------------------------------------------------------------------------------
//判斷是否是枚舉類型
//------------------------------------------------------------------------------
	template<bool flag,class T>
	struct is_enum_helper{
        static no_type	 is_enum_tester(...);
        static yes_type is_enum_tester(int);
        enum{value = sizeof(is_enum_tester(T())) == sizeof(yes_type)};
	};
	template<class T>
	struct is_enum_helper<true,T>{
        enum{value=false};
	};
	template<typename T>
	struct is_enum{
		enum{
            value=is_enum_helper<
                is_integral<T>::value||
                is_float<T>::value||
                is_void<T>::value||
                is_array<T>::value||
                is_class<T>::value||
                is_pointer<T>::value||
                is_reference<T>::value,T>::value
           };
	};
//------------------------------------------------------------------------------
//remove const and volatile modifier
//------------------------------------------------------------------------------
	template<class T>
	struct remove_cv{
		typedef typename cv_traits<T*>::type type;
	};
//------------------------------------------------------------------------------
//判斷B是否是D的基類
//------------------------------------------------------------------------------
#ifdef DNC_CANCHECKBASE
    template <typename B, typename D>
    struct bd_helper{
        template <typename T>
        static yes_type check(D const volatile *, T);
        static no_type  check(B const volatile *, int);
    };
    template<typename B, typename D>
    struct is_base_impl2{
        struct Host{
            operator D const volatile *();
            operator B const volatile *() const;
        };
        enum{value = sizeof(bd_helper<B,D>::check(Host(), 0)) ==
                 sizeof(yes_type)};
    };    
#else
    //broken version
    template<typename B, typename D>
    struct is_base_impl2{
        enum{value = is_convertible<D*,B*>::value};
    };
#endif
    template <typename B, typename D>
    struct is_base_impl3{
        enum{value = false};
    };

    template <bool ic1, bool ic2, bool iss>
    struct is_base_select{
        template <class T, class U>
        struct rebind
        {
            typedef is_base_impl3<T,U> type;
        };
    };

    template <>
    struct is_base_select<true,true,false>{
        template <class T, class U>
        struct rebind
        {
            typedef is_base_impl2<T,U> type;
        };
    };

    template <typename B, typename D>
    struct is_base{
        typedef typename cv_traits<B*>::type ncvB;
        typedef typename cv_traits<D*>::type ncvD;
        enum{
            b_is_class = is_class<B>::value,
                d_is_class = is_class<D>::value,
                bd_is_same = is_same<B,D>::value
                };
        typedef is_base_select<
            b_is_class,
            d_is_class,
            bd_is_same> binder_selector;
        typedef typename binder_selector::template rebind<ncvB,ncvD> binder;
        typedef typename binder::type bound_type;

        enum{value = bound_type::value};
    };
}
#endif //__DNC_TYPETRAITS_H__

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线国偷精品免费看| 五月婷婷综合网| 国产精品夫妻自拍| 亚洲国产精品一区二区久久| ●精品国产综合乱码久久久久| 亚洲丝袜自拍清纯另类| 日韩成人精品在线观看| 日韩av电影免费观看高清完整版 | 亚洲乱码国产乱码精品精可以看 | 亚洲自拍偷拍网站| 久久精品国产久精国产| 91美女福利视频| 日韩一级片网站| 亚洲同性同志一二三专区| 一区二区国产盗摄色噜噜| 国精产品一区一区三区mba视频| 在线亚洲精品福利网址导航| 亚洲精品一线二线三线| 亚洲综合999| 久久狠狠亚洲综合| 色综合久久久久久久久| 国产午夜亚洲精品不卡| 欧美日韩精品欧美日韩精品一综合| 91丨九色丨国产丨porny| 欧美精品99久久久**| 亚洲人一二三区| 国产一区二区成人久久免费影院 | 日韩高清中文字幕一区| 成人免费的视频| 日韩欧美高清dvd碟片| 亚洲精选免费视频| 成人性生交大片免费看视频在线 | 亚洲午夜电影在线观看| 欧美在线视频日韩| 亚洲无人区一区| 欧美三电影在线| 91美女片黄在线| 丁香一区二区三区| 欧美精品一区二区三区在线 | 亚洲青青青在线视频| 99久久99久久精品免费观看| 欧美激情一区二区三区在线| 粉嫩蜜臀av国产精品网站| 国产精品剧情在线亚洲| 91视频com| 91丝袜美腿高跟国产极品老师 | 日韩精品一区二区三区中文精品| 日韩精品亚洲一区二区三区免费| 制服丝袜一区二区三区| 久久99精品视频| 久久蜜臀精品av| 99精品久久久久久| 亚洲成人一区二区| 精品三级av在线| 成人精品小蝌蚪| 午夜视频在线观看一区| 精品久久久久久久一区二区蜜臀| 国产999精品久久久久久绿帽| 亚洲麻豆国产自偷在线| 欧美日本国产一区| 国产福利一区二区三区在线视频| 自拍视频在线观看一区二区| 欧美性猛交xxxx乱大交退制版| 亚洲gay无套男同| 欧美videos大乳护士334| 国产一区二区三区视频在线播放| 成人爱爱电影网址| 亚洲精品视频在线看| 欧美一级xxx| 91玉足脚交白嫩脚丫在线播放| 午夜成人免费电影| 国产精品久久久久久久久免费丝袜 | 欧美精品一区二| 91丝袜国产在线播放| 久久精品噜噜噜成人88aⅴ| 亚洲丝袜自拍清纯另类| 欧美成人video| 欧美亚洲国产bt| 成人看片黄a免费看在线| 免费观看一级特黄欧美大片| 亚洲欧美日本在线| 久久精品亚洲精品国产欧美kt∨ | 亚洲国产一二三| 国产精品美女一区二区| 日韩三级在线免费观看| 色哟哟一区二区在线观看| 国产麻豆精品久久一二三| 香蕉成人伊视频在线观看| 亚洲天堂av老司机| 久久综合久色欧美综合狠狠| 欧美亚洲国产一区二区三区| www.日韩大片| 丁香婷婷综合色啪| 国产伦精品一区二区三区免费迷| 亚洲18色成人| 一区二区三区四区亚洲| 国产人成亚洲第一网站在线播放| 91精品国产综合久久久久久漫画| 色综合天天视频在线观看| 国产91清纯白嫩初高中在线观看| 日本欧美一区二区在线观看| 一区二区三区精品| 中文字幕日韩一区| 国产精品免费av| 国产精品国产三级国产三级人妇 | 奇米亚洲午夜久久精品| 亚洲第一综合色| 亚洲自拍另类综合| 亚洲激情自拍偷拍| 伊人夜夜躁av伊人久久| 亚洲精品一二三区| 一区二区三区国产| 亚洲美女屁股眼交3| 亚洲精品免费看| 亚洲小说春色综合另类电影| 亚洲精品欧美在线| 香蕉加勒比综合久久| 日韩高清一级片| 伦理电影国产精品| 极品少妇xxxx精品少妇偷拍 | 国产欧美日韩综合精品一区二区| 2020日本不卡一区二区视频| 国产视频一区不卡| 国产精品久久二区二区| 亚洲欧美激情插| 亚洲国产精品精华液网站| 三级成人在线视频| 久久成人18免费观看| 国产精品亚洲第一| 91丨九色丨蝌蚪富婆spa| 欧美在线免费观看视频| 欧美精品电影在线播放| 精品蜜桃在线看| 国产日本一区二区| 亚洲永久精品国产| 麻豆精品久久久| 成人永久免费视频| 色婷婷综合久久久中文字幕| 欧美日韩黄视频| 欧美xxxxx牲另类人与| 国产精品短视频| 日韩精品久久久久久| 国产成人8x视频一区二区| 91欧美激情一区二区三区成人| 欧美一区二区观看视频| 亚洲老司机在线| 日韩av在线发布| 国产成人在线网站| 在线精品亚洲一区二区不卡| 欧美夫妻性生活| 国产欧美日韩视频在线观看| 亚洲一区二区在线播放相泽| 久久se精品一区二区| 91香蕉视频污| 精品国产一区二区国模嫣然| 国产精品国产三级国产| 天天色 色综合| 成人精品视频一区二区三区尤物| 欧美欧美午夜aⅴ在线观看| 国产肉丝袜一区二区| 天天av天天翘天天综合网| 成人综合激情网| 日韩欧美国产1| 亚洲韩国一区二区三区| 成人亚洲一区二区一| 日韩欧美另类在线| 亚洲综合色区另类av| 成人一区在线看| 日韩欧美一区二区三区在线| 夜色激情一区二区| 成人黄色片在线观看| 日韩精品91亚洲二区在线观看| 亚洲激情五月婷婷| 国产乱子伦一区二区三区国色天香 | 亚洲女爱视频在线| 国产在线视频一区二区三区| 欧美性生交片4| 国产精品免费视频网站| 毛片av一区二区| 欧美日韩一区成人| 亚洲综合图片区| 一本到高清视频免费精品| 国产午夜精品在线观看| 国产精品一区不卡| 精品少妇一区二区三区在线播放 | 亚洲男人的天堂在线观看| 国产盗摄女厕一区二区三区| 日韩你懂的电影在线观看| 日韩精品免费视频人成| 欧美女孩性生活视频| 一区二区三区高清不卡| 色综合天天综合色综合av| 国产日韩精品一区| 国产成人精品三级| 日本一区二区高清| 成人的网站免费观看| 国产精品不卡在线| av资源网一区| 亚洲视频免费在线| 欧美在线你懂的|