Added wxIsPod<>. Use it in wxAny instead of wxIsMovable<>.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-06-14 15:12:37 +00:00
parent 97b8472b54
commit 109e2ca434
24 changed files with 236 additions and 69 deletions

View File

@@ -45,23 +45,27 @@
When compared to wxVariant, there are various internal implementation
differences as well. For instance, wxAny only allocates separate data
object in heap for large (ie. size in bytes more than
WX_ANY_VALUE_BUFFER_SIZE) or 'non-movable' data types. Pointers, integers,
bools etc. are fitted in the wxAny's own buffer without need for any extra
allocation. Use following code to declare your own data type as 'movable':
object in heap for large (i.e. size in bytes more than
WX_ANY_VALUE_BUFFER_SIZE) or non-POD (Plain Old Data) data types.
Pointers, integers, bools etc. are fitted in the wxAny's internal buffer
without need for any extra allocation. It is possible that wxAny cannot
automatically determine if your own data structure is considered a
POD or not, so you may need to declare it as such explicitly, using
code like this:
@code
#include "wx/meta/movable.h"
WX_DECLARE_TYPE_MOVABLE(MyClass)
#include "wx/meta/pod.h"
WX_DECLARE_TYPE_POD(MyPodStruct)
@endcode
However, you must be aware that 'movable' means such data that can be
copied with memcpy() without corrupting program integrity. For instance,
movable objects usually cannot contain pointers or references to other
data. wxRect, wxPoint, and wxSize are good examples of movable classes.
Be extra careful what you declare as Plain Old Data. It must be such data
that can be copied with memcpy() without corrupting program integrity. For
instance, POD structures usually cannot contain pointers or references to
other data. wxRect, wxPoint, and wxSize are good examples of POD
classes.
Note that pointers to any and all classes are already automatically
declared as movable data.
Note that pointers to any and all types are already automatically
declared as Plain Old Data.
@library{wxbase}
@category{data}