]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/inttypes.h
Make sure all classes have sensible copy semantics
[libs/core.git] / source / core / inttypes.h
index 3bdac35c160925aae2a0b3aef5c6b45a66cdefa0..c0af5ca9f2d2cf485b7a84d56285835087e3119c 100644 (file)
@@ -14,7 +14,11 @@ typedef TypeList<unsigned char, unsigned short, unsigned int, unsigned long>::Ty
 #if defined(__GNUC__)
 #if (__GNUC__>4 || (__GNUC__==4 && __GNUC_MINOR__>=6)) && defined(__LP64__)
 #pragma GCC diagnostic push
+#if __GNUC__>=5
+#pragma GCC diagnostic ignored "-Wpedantic"
+#else
 #pragma GCC diagnostic ignored "-pedantic"
+#endif
 typedef TypeList<StandardSignedTypes, long long, __int128>::Type PlatformSignedTypes;
 typedef TypeList<StandardUnsignedTypes, unsigned long long, unsigned __int128>::Type PlatformUnsignedTypes;
 #pragma GCC diagnostic pop
@@ -46,6 +50,11 @@ struct Int
        typedef typename TypeChooser<PlatformUnsignedTypes, Predicate>::Type UnsignedType;
 };
 
+/** A helper for choosing an integer that's the same size as another type. */
+template<typename T>
+struct MatchingInt: Int<sizeof(T)*CHAR_BIT>
+{ };
+
 // Finally define convenient shorthands for the actual integer types
 typedef Int<8>::SignedType Int8;
 typedef Int<8>::UnsignedType UInt8;
@@ -55,6 +64,7 @@ typedef Int<32>::SignedType Int32;
 typedef Int<32>::UnsignedType UInt32;
 typedef Int<64>::SignedType Int64;
 typedef Int<64>::UnsignedType UInt64;
+typedef MatchingInt<void *>::UnsignedType IntPtr;
 
 } // namespace Msp