2 * TypeInfo support code.
4 * Copyright: Copyright Digital Mars 2004 - 2009.
5 * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6 * Authors: Walter Bright
9 /* Copyright Digital Mars 2004 - 2009.
10 * Distributed under the Boost Software License, Version 1.0.
11 * (See accompanying file LICENSE or copy at
12 * http://www.boost.org/LICENSE_1_0.txt)
14 module rt.typeinfo.ti_ptr;
16 // internal typeinfo for any pointer type
17 // please keep in sync with TypeInfo_Pointer
19 class TypeInfo_P : TypeInfo
26 override size_t getHash(in void* p)
28 return cast(size_t)*cast(void**)p;
31 override bool equals(in void* p1, in void* p2)
33 return *cast(void**)p1 == *cast(void**)p2;
36 override int compare(in void* p1, in void* p2)
38 if (*cast(void**)p1 < *cast(void**)p2)
40 else if (*cast(void**)p1 > *cast(void**)p2)
46 override @property size_t tsize() nothrow pure
48 return (void*).sizeof;
51 override const(void)[] initializer() const @trusted
53 return (cast(void *)null)[0 .. (void*).sizeof];
56 override void swap(void *p1, void *p2)
58 void* tmp = *cast(void**)p1;
59 *cast(void**)p1 = *cast(void**)p2;
60 *cast(void**)p2 = tmp;
63 override @property uint flags() nothrow pure const { return 1; }