~registry/dolphin-emu/triforce

« back to all changes in this revision

Viewing changes to Externals/wxWidgets3/include/wx/meta/movable.h

  • Committer: Sérgio Benjamim
  • Date: 2015-02-13 05:54:40 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20150213055440-ey2rt3sjpy27km78
Dolphin Triforce branch from code.google, commit b957980 (4.0-315).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////////
 
2
// Name:        wx/meta/movable.h
 
3
// Purpose:     Test if a type is movable using memmove() etc.
 
4
// Author:      Vaclav Slavik
 
5
// Created:     2008-01-21
 
6
// Copyright:   (c) 2008 Vaclav Slavik
 
7
// Licence:     wxWindows licence
 
8
/////////////////////////////////////////////////////////////////////////////
 
9
 
 
10
#ifndef _WX_META_MOVABLE_H_
 
11
#define _WX_META_MOVABLE_H_
 
12
 
 
13
#include "wx/meta/pod.h"
 
14
#include "wx/string.h" // for wxIsMovable<wxString> specialization
 
15
 
 
16
// Helper to decide if an object of type T is "movable", i.e. if it can be
 
17
// copied to another memory location using memmove() or realloc() C functions.
 
18
// C++ only gurantees that POD types (including primitive types) are
 
19
// movable.
 
20
template<typename T>
 
21
struct wxIsMovable
 
22
{
 
23
    wxDEFINE_TEMPLATE_BOOL_VALUE(wxIsPod<T>::value);
 
24
};
 
25
 
 
26
// Macro to add wxIsMovable<T> specialization for given type that marks it
 
27
// as movable:
 
28
#define WX_DECLARE_TYPE_MOVABLE(type)                       \
 
29
    template<> struct wxIsMovable<type>                     \
 
30
    {                                                       \
 
31
        wxDEFINE_TEMPLATE_BOOL_VALUE(true);                 \
 
32
    };
 
33
 
 
34
// Our implementation of wxString is written in such way that it's safe to move
 
35
// it around (unless position cache is used which unfortunately breaks this).
 
36
// OTOH, we don't know anything about std::string.
 
37
// (NB: we don't put this into string.h and choose to include wx/string.h from
 
38
// here instead so that rarely-used wxIsMovable<T> code isn't included by
 
39
// everything)
 
40
#if !wxUSE_STD_STRING && !wxUSE_STRING_POS_CACHE
 
41
WX_DECLARE_TYPE_MOVABLE(wxString)
 
42
#endif
 
43
 
 
44
#endif // _WX_META_MOVABLE_H_