TypeTraits<T>::BaseType, PtrBaseType and IsPtr
This commit is contained in:
@@ -20,302 +20,581 @@
|
||||
#ifndef TYPE_TRAITS_H
|
||||
#define TYPE_TRAITS_H
|
||||
|
||||
#include "ptr.h"
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \ingroup object
|
||||
* TypeTraits introspection template.
|
||||
* \file
|
||||
* \ingroup object
|
||||
* TypeTraits introspection template.
|
||||
*/
|
||||
|
||||
/** Type trait reference values */
|
||||
/**
|
||||
* \ingroup object
|
||||
* Inspect a type to deduce its features.
|
||||
* \tparam T \deduced The type to inspect.
|
||||
*/
|
||||
template <typename T>
|
||||
struct TypeTraits
|
||||
{
|
||||
private:
|
||||
struct NullType {}; //!< Null value type traits
|
||||
template <typename U> struct UnConst //!< Non-const type
|
||||
/** Null value type traits. */
|
||||
struct NullType {};
|
||||
/**
|
||||
* Not a const type.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct UnConst
|
||||
{
|
||||
typedef U Result; //!< Non-const result type
|
||||
typedef U Result; /**< Non-const type. */
|
||||
};
|
||||
template <typename U> struct UnConst<const U> //!< Non-const template type traits
|
||||
/**
|
||||
* Const type.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct UnConst<const U>
|
||||
{
|
||||
typedef U Result; //!< Non-const result type
|
||||
typedef U Result; /**< Non-const type. */
|
||||
};
|
||||
template <typename U> struct ReferenceTraits //!< Non-reference type traits
|
||||
/**
|
||||
* Not a reference type.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct ReferenceTraits
|
||||
{
|
||||
enum { IsReference = 0 /**< Non-reference value */ };
|
||||
typedef U ReferencedType; //!< Non-referenced result type
|
||||
/** Value. */ enum { IsReference = 0 /**< Not a reference type. */ };
|
||||
typedef U ReferencedType; /**< Base type. */
|
||||
};
|
||||
template <typename U> struct ReferenceTraits<U&>//!< Reference type traits
|
||||
/**
|
||||
* Reference type.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct ReferenceTraits<U&>
|
||||
{
|
||||
enum { IsReference = 1 /**< Reference value */ };
|
||||
typedef U ReferencedType; //!< Referenced result type
|
||||
/** Value. */ enum { IsReference = 1 /**< Reference type. */ };
|
||||
typedef U ReferencedType; /**< Base type. */
|
||||
};
|
||||
template <typename U> struct PointerTraits //!< Non-pointer type traits
|
||||
/**
|
||||
* Not a pointer type.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct PointerTraits
|
||||
{
|
||||
enum { IsPointer = 0}; //!< Non-pointer value
|
||||
typedef U PointeeType; //!< Non-pointer result type
|
||||
/** Value. */ enum { IsPointer = 0, /**< Not a pointer type. */
|
||||
IsPtr = 0 /**< Not a Ptr type. */};
|
||||
typedef U PointeeType; /**< Base type. */
|
||||
};
|
||||
template <typename U> struct PointerTraits<U *> //!< Pointer type traits
|
||||
/**
|
||||
* Pointer type.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct PointerTraits<U *>
|
||||
{
|
||||
enum { IsPointer = 1}; //!< Pointer value
|
||||
typedef U PointeeType; //!< Pointer result type
|
||||
};
|
||||
template <typename U> struct FunctionPtrTraits //!< Non-function pointer type traits
|
||||
/** Value. */ enum { IsPointer = 1, /**< Pointer type. */
|
||||
IsPtr = 0 /**< Not a Ptr type. */};
|
||||
typedef U PointeeType; /**< Pointee type. */
|
||||
};
|
||||
/**
|
||||
* Ptr type.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct PointerTraits<ns3::Ptr<U> >
|
||||
{
|
||||
enum { IsFunctionPointer = 0}; //!< Non-function pointer value
|
||||
typedef NullType ReturnType; //!< Non-function pointer result type
|
||||
/** Value. */ enum { IsPointer = 0, /**< Not a pointer type. */
|
||||
IsPtr = 1 /**< Ptr type. */};
|
||||
typedef U PointeeType; /**< Pointee type. */
|
||||
};
|
||||
template <typename U>
|
||||
struct FunctionPtrTraits <U (*)(void)> //!< Function pointer type traits
|
||||
/**
|
||||
* Base type, after removing \c &, \c * and \c const.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct Base
|
||||
{
|
||||
enum { IsFunctionPointer = 1}; //!< Function pointer value
|
||||
enum { nArgs = 0}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef U Type; /**< Base type. */
|
||||
};
|
||||
template <typename U, typename V1>
|
||||
struct FunctionPtrTraits <U (*)(V1)> //!< Function pointer type traits
|
||||
{
|
||||
enum { IsFunctionPointer = 1}; //!< Function pointer value
|
||||
enum { nArgs = 1}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef V1 Arg1Type; //!< First argument type
|
||||
};
|
||||
template <typename U, typename V1, typename V2>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2)> //!< Function pointer type traits
|
||||
{
|
||||
enum { IsFunctionPointer = 1}; //!< Function pointer value
|
||||
enum { nArgs = 2}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef V1 Arg1Type; //!< First argument type
|
||||
typedef V2 Arg2Type; //!< Second argument type
|
||||
};
|
||||
template <typename U, typename V1, typename V2,
|
||||
typename V3>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2,V3)> //!< Function pointer type traits
|
||||
{
|
||||
enum { IsFunctionPointer = 1}; //!< Function pointer value
|
||||
enum { nArgs = 3}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef V1 Arg1Type; //!< First argument type
|
||||
typedef V2 Arg2Type; //!< Second argument type
|
||||
typedef V3 Arg3Type; //!< Third argument type
|
||||
};
|
||||
template <typename U, typename V1, typename V2,
|
||||
typename V3, typename V4>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4)> //!< Function pointer type traits
|
||||
{
|
||||
enum { IsFunctionPointer = 1}; //!< Function pointer value
|
||||
enum { nArgs = 4}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef V1 Arg1Type; //!< First argument type
|
||||
typedef V2 Arg2Type; //!< Second argument type
|
||||
typedef V3 Arg3Type; //!< Third argument type
|
||||
typedef V4 Arg4Type; //!< Fourth argument type
|
||||
};
|
||||
template <typename U, typename V1, typename V2,
|
||||
typename V3, typename V4,
|
||||
typename V5>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4,V5)>//!< Function pointer type traits
|
||||
{
|
||||
enum { IsFunctionPointer = 1}; //!< Function pointer value
|
||||
enum { nArgs = 5}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef V1 Arg1Type; //!< First argument type
|
||||
typedef V2 Arg2Type; //!< Second argument type
|
||||
typedef V3 Arg3Type; //!< Third argument type
|
||||
typedef V4 Arg4Type; //!< Fourth argument type
|
||||
typedef V5 Arg5Type; //!< Fifth argument type
|
||||
};
|
||||
template <typename U, typename V1, typename V2,
|
||||
typename V3, typename V4,
|
||||
typename V5, typename V6>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4,V5,V6)> //!< Function pointer type traits
|
||||
{
|
||||
enum { IsFunctionPointer = 1}; //!< Function pointer value
|
||||
enum { nArgs = 6}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef V1 Arg1Type; //!< First argument type
|
||||
typedef V2 Arg2Type; //!< Second argument type
|
||||
typedef V3 Arg3Type; //!< Third argument type
|
||||
typedef V4 Arg4Type; //!< Fourth argument type
|
||||
typedef V5 Arg5Type; //!< Fifth argument type
|
||||
typedef V6 Arg6Type; //!< Sixth argument type
|
||||
};
|
||||
template <typename U> struct PtrToMemberTraits //!< Pointer to member type traits
|
||||
/**
|
||||
* Base type, after removing \c &.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct Base <U &>
|
||||
{
|
||||
enum { IsPointerToMember = 0}; //!< Non-pointer to member value
|
||||
typedef typename Base<U>::Type Type; /**< Base type. */
|
||||
};
|
||||
template <typename U, typename V>
|
||||
struct PtrToMemberTraits <U (V::*) (void)> //!< Pointer to member type traits
|
||||
/**
|
||||
* Base type, after removing \c *.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct Base <U *>
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 0}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef typename Base<U>::Type Type; /**< Base type. */
|
||||
};
|
||||
template <typename U, typename V>
|
||||
struct PtrToMemberTraits <U (V::*) (void) const>//!< Pointer to const member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 0}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
/**
|
||||
* Base type, after removing \c const.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct Base <const U >
|
||||
{
|
||||
typedef typename Base<U>::Type Type; /**< Base type. */
|
||||
};
|
||||
template <typename U, typename V,typename W1>
|
||||
struct PtrToMemberTraits <U (V::*) (W1)> //!< Pointer to member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 1}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
/**
|
||||
* Base type of a Ptr.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct PtrBase
|
||||
{
|
||||
typedef U Type; /**< Base type. */
|
||||
};
|
||||
template <typename U, typename V,typename W1>
|
||||
struct PtrToMemberTraits <U (V::*) (W1) const> //!< Pointer to const member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 1}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
/**
|
||||
* Base type of a Ptr.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct PtrBase <ns3::Ptr<U> >
|
||||
{
|
||||
typedef U Type; /**< Base type. */
|
||||
};
|
||||
template <typename U, typename V,typename W1, typename W2>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2)> //!< Pointer to member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 2}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
/**
|
||||
* Not a function pointer type.
|
||||
* \tparam U \deduced The type being inspected.
|
||||
*/
|
||||
template <typename U> struct FunctionPtrTraits
|
||||
{
|
||||
/** Value. */ enum { IsFunctionPointer = 0 /**< Not a function pointer. */ };
|
||||
typedef NullType ReturnType; /**< Return type. */
|
||||
};
|
||||
template <typename U, typename V,typename W1, typename W2>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2) const> //!< Pointer to const member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 2}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
/**
|
||||
* Function pointer type.
|
||||
* \tparam U \deduced Return type.
|
||||
*/
|
||||
template <typename U>
|
||||
struct FunctionPtrTraits <U (*)(void)>
|
||||
{
|
||||
/** Value. */ enum { IsFunctionPointer = 1 /**< Function pointer. */ };
|
||||
/** Value. */ enum { nArgs = 0 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
};
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2,
|
||||
typename W3>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3)> //!< Pointer to member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 3}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
typedef W3 Arg3Type; //!< Third argument type
|
||||
/**
|
||||
* Function pointer type.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V1 \deduced Argument type.
|
||||
*/
|
||||
template <typename U,
|
||||
typename V1>
|
||||
struct FunctionPtrTraits <U (*)(V1)>
|
||||
{
|
||||
/** Value. */ enum { IsFunctionPointer = 1 /**< Function pointer. */ };
|
||||
/** Value. */ enum { nArgs = 1 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef V1 Arg1Type; /**< First argument type. */
|
||||
};
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2,
|
||||
typename W3>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3) const> //!< Pointer to const member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 3}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
typedef W3 Arg3Type; //!< Third argument type
|
||||
/**
|
||||
* Function pointer type.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V1 \deduced Argument type.
|
||||
* \tparam V2 \deduced Argument type.
|
||||
*/
|
||||
template <typename U,
|
||||
typename V1, typename V2>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2)>
|
||||
{
|
||||
/** Value. */ enum { IsFunctionPointer = 1 /**< Function pointer. */ };
|
||||
/** Value. */ enum { nArgs = 2 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef V1 Arg1Type; /**< First argument type. */
|
||||
typedef V2 Arg2Type; /**< Second argument type. */
|
||||
};
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2,
|
||||
typename W3, typename W4>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4)> //!< Pointer to member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 4}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
typedef W3 Arg3Type; //!< Third argument type
|
||||
typedef W4 Arg4Type; //!< Fourth argument type
|
||||
/**
|
||||
* Function pointer type.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V1 \deduced Argument type.
|
||||
* \tparam V2 \deduced Argument type.
|
||||
* \tparam V3 \deduced Argument type.
|
||||
*/
|
||||
template <typename U,
|
||||
typename V1, typename V2, typename V3>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2,V3)>
|
||||
{
|
||||
/** Value. */ enum { IsFunctionPointer = 1 /**< Function pointer. */ };
|
||||
/** Value. */ enum { nArgs = 3 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef V1 Arg1Type; /**< First argument type. */
|
||||
typedef V2 Arg2Type; /**< Second argument type. */
|
||||
typedef V3 Arg3Type; /**< Third argument type. */
|
||||
};
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2,
|
||||
typename W3, typename W4>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4) const> //!< Pointer to const member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 4}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
typedef W3 Arg3Type; //!< Third argument type
|
||||
typedef W4 Arg4Type; //!< Fourth argument type
|
||||
/**
|
||||
* Function pointer type.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V1 \deduced Argument type.
|
||||
* \tparam V2 \deduced Argument type.
|
||||
* \tparam V3 \deduced Argument type.
|
||||
* \tparam V4 \deduced Argument type.
|
||||
*/
|
||||
template <typename U,
|
||||
typename V1, typename V2, typename V3,
|
||||
typename V4>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4)>
|
||||
{
|
||||
/** Value. */ enum { IsFunctionPointer = 1 /**< Function pointer. */ };
|
||||
/** Value. */ enum { nArgs = 4 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef V1 Arg1Type; /**< First argument type. */
|
||||
typedef V2 Arg2Type; /**< Second argument type. */
|
||||
typedef V3 Arg3Type; /**< Third argument type. */
|
||||
typedef V4 Arg4Type; /**< Fourth argument type. */
|
||||
};
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2,
|
||||
typename W3, typename W4,
|
||||
typename W5>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5)> //!< Pointer to member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 5}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
typedef W3 Arg3Type; //!< Third argument type
|
||||
typedef W4 Arg4Type; //!< Fourth argument type
|
||||
typedef W5 Arg5Type; //!< Fifth argument type
|
||||
/**
|
||||
* Function pointer type.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V1 \deduced Argument type.
|
||||
* \tparam V2 \deduced Argument type.
|
||||
* \tparam V3 \deduced Argument type.
|
||||
* \tparam V4 \deduced Argument type.
|
||||
* \tparam V5 \deduced Argument type.
|
||||
*/
|
||||
template <typename U,
|
||||
typename V1, typename V2, typename V3,
|
||||
typename V4, typename V5>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4,V5)>
|
||||
{
|
||||
/** Value. */ enum { IsFunctionPointer = 1 /**< Function pointer. */ };
|
||||
/** Value. */ enum { nArgs = 5 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef V1 Arg1Type; /**< First argument type. */
|
||||
typedef V2 Arg2Type; /**< Second argument type. */
|
||||
typedef V3 Arg3Type; /**< Third argument type. */
|
||||
typedef V4 Arg4Type; /**< Fourth argument type. */
|
||||
typedef V5 Arg5Type; /**< Fifth argument type. */
|
||||
};
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2,
|
||||
typename W3, typename W4,
|
||||
typename W5>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5) const> //!< Pointer to const member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 5}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
typedef W3 Arg3Type; //!< Third argument type
|
||||
typedef W4 Arg4Type; //!< Fourth argument type
|
||||
typedef W5 Arg5Type; //!< Fifth argument type
|
||||
/**
|
||||
* Function pointer type.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V1 \deduced Argument type.
|
||||
* \tparam V2 \deduced Argument type.
|
||||
* \tparam V3 \deduced Argument type.
|
||||
* \tparam V4 \deduced Argument type.
|
||||
* \tparam V5 \deduced Argument type.
|
||||
* \tparam V6 \deduced Argument type.
|
||||
*/
|
||||
template <typename U,
|
||||
typename V1, typename V2, typename V3,
|
||||
typename V4, typename V5, typename V6>
|
||||
struct FunctionPtrTraits <U (*)(V1,V2,V3,V4,V5,V6)>
|
||||
{
|
||||
/** Value. */ enum { IsFunctionPointer = 1 /**< Function pointer. */ };
|
||||
/** Value. */ enum { nArgs = 6 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef V1 Arg1Type; /**< First argument type. */
|
||||
typedef V2 Arg2Type; /**< Second argument type. */
|
||||
typedef V3 Arg3Type; /**< Third argument type. */
|
||||
typedef V4 Arg4Type; /**< Fourth argument type. */
|
||||
typedef V5 Arg5Type; /**< Fifth argument type. */
|
||||
typedef V6 Arg6Type; /**< Sixth argument type. */
|
||||
};
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2,
|
||||
typename W3, typename W4,
|
||||
typename W5, typename W6>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5,W6)> //!< Pointer to member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 6}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
typedef W3 Arg3Type; //!< Third argument type
|
||||
typedef W4 Arg4Type; //!< Fourth argument type
|
||||
typedef W5 Arg5Type; //!< Fifth argument type
|
||||
typedef W6 Arg6Type; //!< Sixth argument type
|
||||
/**
|
||||
* Not a pointer to member type.
|
||||
* \tparam U \deduced Return type.
|
||||
*/
|
||||
template <typename U> struct PtrToMemberTraits
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 0 /**< Not a pointer to member. */ };
|
||||
};
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2,
|
||||
typename W3, typename W4,
|
||||
typename W5, typename W6>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5,W6) const> //!< Pointer to const member type traits
|
||||
{
|
||||
enum { IsPointerToMember = 1}; //!< Pointer to member value
|
||||
enum { nArgs = 6}; //!< Number of arguments
|
||||
typedef U ReturnType; //!< Return type
|
||||
typedef W1 Arg1Type; //!< First argument type
|
||||
typedef W2 Arg2Type; //!< Second argument type
|
||||
typedef W3 Arg3Type; //!< Third argument type
|
||||
typedef W4 Arg4Type; //!< Fourth argument type
|
||||
typedef W5 Arg5Type; //!< Fifth argument type
|
||||
typedef W6 Arg6Type; //!< Sixth argument type
|
||||
/**
|
||||
* Pointer to member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
*/
|
||||
template <typename U, typename V>
|
||||
struct PtrToMemberTraits <U (V::*) (void)>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 0 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to const member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
*/
|
||||
template <typename U, typename V>
|
||||
struct PtrToMemberTraits <U (V::*) (void) const>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 0 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1>
|
||||
struct PtrToMemberTraits <U (V::*) (W1)>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 1 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to const member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1>
|
||||
struct PtrToMemberTraits <U (V::*) (W1) const>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 1 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2)>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 2 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to const member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2) const>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 2 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
* \tparam W3 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2, typename W3>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3)>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 3 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
typedef W3 Arg3Type; /**< Third argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to const member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
* \tparam W3 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2, typename W3>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3) const>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 3 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
typedef W3 Arg3Type; /**< Third argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
* \tparam W3 \deduced Argument type.
|
||||
* \tparam W4 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2, typename W3,
|
||||
typename W4>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4)>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 4 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
typedef W3 Arg3Type; /**< Third argument type. */
|
||||
typedef W4 Arg4Type; /**< Fourth argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to const member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
* \tparam W3 \deduced Argument type.
|
||||
* \tparam W4 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2, typename W3,
|
||||
typename W4>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4) const>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 4 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
typedef W3 Arg3Type; /**< Third argument type. */
|
||||
typedef W4 Arg4Type; /**< Fourth argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
* \tparam W3 \deduced Argument type.
|
||||
* \tparam W4 \deduced Argument type.
|
||||
* \tparam W5 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2, typename W3,
|
||||
typename W4, typename W5>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5)>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 5 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
typedef W3 Arg3Type; /**< Third argument type. */
|
||||
typedef W4 Arg4Type; /**< Fourth argument type. */
|
||||
typedef W5 Arg5Type; /**< Fifth argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to const member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
* \tparam W3 \deduced Argument type.
|
||||
* \tparam W4 \deduced Argument type.
|
||||
* \tparam W5 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2, typename W3,
|
||||
typename W4, typename W5>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5) const>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 5 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
typedef W3 Arg3Type; /**< Third argument type. */
|
||||
typedef W4 Arg4Type; /**< Fourth argument type. */
|
||||
typedef W5 Arg5Type; /**< Fifth argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
* \tparam W3 \deduced Argument type.
|
||||
* \tparam W4 \deduced Argument type.
|
||||
* \tparam W5 \deduced Argument type.
|
||||
* \tparam W6 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2, typename W3,
|
||||
typename W4, typename W5, typename W6>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5,W6)>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 6 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
typedef W3 Arg3Type; /**< Third argument type. */
|
||||
typedef W4 Arg4Type; /**< Fourth argument type. */
|
||||
typedef W5 Arg5Type; /**< Fifth argument type. */
|
||||
typedef W6 Arg6Type; /**< Sixth argument type. */
|
||||
};
|
||||
/**
|
||||
* Pointer to const member function.
|
||||
* \tparam U \deduced Return type.
|
||||
* \tparam V \deduced Class type.
|
||||
* \tparam W1 \deduced Argument type.
|
||||
* \tparam W2 \deduced Argument type.
|
||||
* \tparam W3 \deduced Argument type.
|
||||
* \tparam W4 \deduced Argument type.
|
||||
* \tparam W5 \deduced Argument type.
|
||||
* \tparam W6 \deduced Argument type.
|
||||
*/
|
||||
template <typename U, typename V,
|
||||
typename W1, typename W2, typename W3,
|
||||
typename W4, typename W5, typename W6>
|
||||
struct PtrToMemberTraits <U (V::*) (W1,W2,W3,W4,W5,W6) const>
|
||||
{
|
||||
/** Value. */ enum { IsPointerToMember = 1 /**< Pointer to member function. */ };
|
||||
/** Value. */ enum { nArgs = 6 /**< Number of arguments. */ };
|
||||
typedef U ReturnType; /**< Return type. */
|
||||
typedef W1 Arg1Type; /**< First argument type. */
|
||||
typedef W2 Arg2Type; /**< Second argument type. */
|
||||
typedef W3 Arg3Type; /**< Third argument type. */
|
||||
typedef W4 Arg4Type; /**< Fourth argument type. */
|
||||
typedef W5 Arg5Type; /**< Fifth argument type. */
|
||||
typedef W6 Arg6Type; /**< Sixth argument type. */
|
||||
};
|
||||
|
||||
public:
|
||||
typedef typename UnConst<T>::Result NonConstType; //!< Non-const type
|
||||
typedef typename ReferenceTraits<T>::ReferencedType ReferencedType; //!< Referenced type
|
||||
typedef typename PointerTraits<T>::PointeeType PointeeType; //!< Pointee type
|
||||
enum { IsPointerToMember = PtrToMemberTraits<T>::IsPointerToMember}; //!< Pointer to member predicate
|
||||
enum { IsPointer = PointerTraits<T>::IsPointer}; //!< Pointer predicate
|
||||
enum { IsReference = ReferenceTraits<T>::IsReference}; //!< Reference predicate
|
||||
enum { IsFunctionPointer = FunctionPtrTraits<T>::IsFunctionPointer}; //!< Function pointer predicate
|
||||
typedef PtrToMemberTraits<T> PointerToMemberTraits; //!< Pointer to member traits type
|
||||
typedef FunctionPtrTraits<T> FunctionPointerTraits; //!< Function pointer traits
|
||||
/** Not a const type. */
|
||||
typedef typename UnConst<T>::Result NonConstType;
|
||||
/** Referenced type. */
|
||||
typedef typename ReferenceTraits<T>::ReferencedType ReferencedType;
|
||||
/** Pointee type. */
|
||||
typedef typename PointerTraits<T>::PointeeType PointeeType;
|
||||
/** Base type, after removing \c &, \c * and \c const. */
|
||||
typedef typename Base<T>::Type BaseType;
|
||||
/** Ptr base type. */
|
||||
typedef typename PtrBase<T>::Type PtrBaseType;
|
||||
/** Predicates. */
|
||||
enum {
|
||||
/** Pointer to member predicate. */
|
||||
IsPointerToMember = PtrToMemberTraits<T>::IsPointerToMember,
|
||||
/** Pointer predicate. */
|
||||
IsPointer = PointerTraits<T>::IsPointer,
|
||||
/** Ptr predicate. */
|
||||
IsPtr = PointerTraits<T>::IsPtr,
|
||||
/** Reference predicate. */
|
||||
IsReference = ReferenceTraits<T>::IsReference,
|
||||
/** Function pointer predicate. */
|
||||
IsFunctionPointer = FunctionPtrTraits<T>::IsFunctionPointer
|
||||
};
|
||||
/** Pointer to member traits type. */
|
||||
typedef PtrToMemberTraits<T> PointerToMemberTraits;
|
||||
/** Function pointer traits. */
|
||||
typedef FunctionPtrTraits<T> FunctionPointerTraits;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user