diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WTF/wtf/VectorTraits.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WTF/wtf/VectorTraits.h')
-rw-r--r-- | Source/WTF/wtf/VectorTraits.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/Source/WTF/wtf/VectorTraits.h b/Source/WTF/wtf/VectorTraits.h index e3595cde1..b3fb077bb 100644 --- a/Source/WTF/wtf/VectorTraits.h +++ b/Source/WTF/wtf/VectorTraits.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2016 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,11 +21,11 @@ #ifndef WTF_VectorTraits_h #define WTF_VectorTraits_h -#include <wtf/OwnPtr.h> #include <wtf/Ref.h> #include <wtf/RefPtr.h> #include <utility> #include <memory> +#include <type_traits> namespace WTF { @@ -52,7 +52,7 @@ namespace WTF { static const bool canInitializeWithMemset = false; static const bool canMoveWithMemcpy = true; static const bool canCopyWithMemcpy = true; - static const bool canFillWithMemset = sizeof(T) == sizeof(char); + static const bool canFillWithMemset = sizeof(T) == sizeof(char) && std::is_integral<T>::value; static const bool canCompareWithMemcmp = true; }; @@ -66,19 +66,13 @@ namespace WTF { static const bool canCompareWithMemcmp = true; }; - // We know OwnPtr and RefPtr are simple enough that initializing to 0 and moving with memcpy - // (and then not destructing the original) will totally work - template<typename P> - struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits { }; + // We know smart pointers are simple enough that initializing to 0 and moving with memcpy + // (and then not destructing the original) will work. - template<typename P> - struct VectorTraits<OwnPtr<P>> : SimpleClassVectorTraits { }; - - template<typename P> - struct VectorTraits<Ref<P>> : SimpleClassVectorTraits { }; - - template<> - struct VectorTraits<AtomicString> : SimpleClassVectorTraits { }; + template<typename P> struct VectorTraits<RefPtr<P>> : SimpleClassVectorTraits { }; + template<typename P> struct VectorTraits<std::unique_ptr<P>> : SimpleClassVectorTraits { }; + template<typename P> struct VectorTraits<Ref<P>> : SimpleClassVectorTraits { }; + template<> struct VectorTraits<AtomicString> : SimpleClassVectorTraits { }; template<typename First, typename Second> struct VectorTraits<std::pair<First, Second>> |