X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fwtf%2FTypeTraits.h;h=92f8cebb2b7b02d00e717be8d7902c8af2e656da;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=3637304b4680f221d39d09d3591ca9157513150e;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/wtf/TypeTraits.h b/src/third_party/WebKit/Source/wtf/TypeTraits.h index 3637304..92f8ceb 100644 --- a/src/third_party/WebKit/Source/wtf/TypeTraits.h +++ b/src/third_party/WebKit/Source/wtf/TypeTraits.h @@ -29,7 +29,7 @@ namespace WTF { // The following are provided in this file: // // IsInteger::value - // IsPod::value, see the definition for a note about its limitations + // IsPod::value // IsConvertibleToInteger::value // // IsArray::value @@ -72,6 +72,26 @@ namespace WTF { template struct IsArithmetic { static const bool value = IsInteger::value || IsFloatingPoint::value; }; + template struct IsPointer { + static const bool value = false; + }; + + template struct IsPointer { + static const bool value = true; + }; + + template struct IsPointer { + static const bool value = true; + }; + + template struct IsEnum { + static const bool value = __is_enum(T); + }; + + template struct IsScalar { + static const bool value = IsEnum::value || IsArithmetic::value || IsPointer::value; + }; + template struct IsWeak { static const bool value = false; }; enum WeakHandlingFlag { @@ -79,10 +99,25 @@ namespace WTF { WeakHandlingInCollections }; - // IsPod is misnamed as it doesn't cover all plain old data (pod) types. - // Specifically, it doesn't allow for enums or for structs. - template struct IsPod { static const bool value = IsArithmetic::value; }; - template struct IsPod { static const bool value = true; }; + template struct IsPod { + static const bool value = __is_pod(T); + }; + + template struct IsTriviallyCopyAssignable { + static const bool value = __has_trivial_assign(T); + }; + + template struct IsTriviallyMoveAssignable { + static const bool value = __has_trivial_assign(T); + }; + + template struct IsTriviallyDefaultConstructible { + static const bool value = __has_trivial_constructor(T); + }; + + template struct IsTriviallyDestructible { + static const bool value = __has_trivial_destructor(T); + }; template class IsConvertibleToInteger { // Avoid "possible loss of data" warning when using Microsoft's C++ compiler @@ -158,13 +193,13 @@ namespace WTF { static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType); }; - template class U> class IsSubclassOfTemplate { + template class U> class IsSubclassOfTemplate { typedef char YesType; struct NoType { char padding[8]; }; - template static YesType subclassCheck(U*); + template static YesType subclassCheck(U*); static NoType subclassCheck(...); static T* t; public: @@ -197,32 +232,6 @@ namespace WTF { static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType); }; - template class U> class IsSubclassOfTemplate3 { - typedef char YesType; - struct NoType { - char padding[8]; - }; - - template static YesType subclassCheck(U*); - static NoType subclassCheck(...); - static T* t; - public: - static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType); - }; - - template class U> class IsSubclassOfTemplate5 { - typedef char YesType; - struct NoType { - char padding[8]; - }; - - template static YesType subclassCheck(U*); - static NoType subclassCheck(...); - static T* t; - public: - static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType); - }; - template class OuterTemplate> struct RemoveTemplate { typedef T Type; };