Add wx/meta/removeref.h header defining wxRemoveRef<> helper.

This is a very simple template allowing to remove the reference from the given
type, similar to std::remove_reference<>.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72721 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-10-23 12:02:00 +00:00
parent 1e30d94eff
commit 32753ae949
10 changed files with 50 additions and 0 deletions

View File

@ -496,6 +496,7 @@ ALL_BASE_HEADERS = \
wx/meta/int2type.h \
wx/meta/movable.h \
wx/meta/pod.h \
wx/meta/removeref.h \
wx/fswatcher.h \
wx/generic/fswatcher.h \
$(BASE_PLATFORM_HDR) \
@ -676,6 +677,7 @@ ALL_PORTS_BASE_HEADERS = \
wx/meta/int2type.h \
wx/meta/movable.h \
wx/meta/pod.h \
wx/meta/removeref.h \
wx/fswatcher.h \
wx/generic/fswatcher.h \
wx/unix/app.h \

View File

@ -543,6 +543,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/meta/int2type.h
wx/meta/movable.h
wx/meta/pod.h
wx/meta/removeref.h
wx/fswatcher.h
wx/generic/fswatcher.h
</set>

View File

@ -1475,6 +1475,10 @@ SOURCE=..\..\include\wx\regex.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\meta\removeref.h
# End Source File
# Begin Source File
SOURCE=..\..\include\wx\rtti.h
# End Source File
# Begin Source File

View File

@ -1530,6 +1530,9 @@
<File
RelativePath="..\..\include\wx\regex.h">
</File>
<File
RelativePath="..\..\include\wx\meta\removeref.h">
</File>
<File
RelativePath="..\..\include\wx\rtti.h">
</File>

View File

@ -2061,6 +2061,10 @@
RelativePath="..\..\include\wx\regex.h"
>
</File>
<File
RelativePath="..\..\include\wx\meta\removeref.h"
>
</File>
<File
RelativePath="..\..\include\wx\rtti.h"
>

View File

@ -2057,6 +2057,10 @@
RelativePath="..\..\include\wx\regex.h"
>
</File>
<File
RelativePath="..\..\include\wx\meta\removeref.h"
>
</File>
<File
RelativePath="..\..\include\wx\rtti.h"
>

View File

@ -0,0 +1,29 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/meta/removeref.h
// Purpose: Allows to remove a reference from a type.
// Author: Vadim Zeitlin
// Created: 2012-10-21
// RCS-ID: $Id$
// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_META_REMOVEREF_H_
#define _WX_META_REMOVEREF_H_
// wxRemoveRef<> is similar to C++11 std::remove_reference<> but works with any
// compilers (but, to compensate for this, doesn't work with rvalue references).
template <typename T>
struct wxRemoveRef
{
typedef T type;
};
template <typename T>
struct wxRemoveRef<T&>
{
typedef T type;
};
#endif // _WX_META_REMOVEREF_H_

View File

@ -385,6 +385,7 @@ wx/meta/implicitconversion.h
wx/meta/int2type.h
wx/meta/movable.h
wx/meta/pod.h
wx/meta/removeref.h
wx/fswatcher.h
wx/generic/fswatcher.h
wx/unix/app.h

View File

@ -250,6 +250,7 @@ wx/meta/implicitconversion.h
wx/meta/int2type.h
wx/meta/movable.h
wx/meta/pod.h
wx/meta/removeref.h
wx/fswatcher.h
wx/generic/fswatcher.h
wx/unix/app.h

View File

@ -274,6 +274,7 @@ wx/meta/implicitconversion.h
wx/meta/int2type.h
wx/meta/movable.h
wx/meta/pod.h
wx/meta/removeref.h
wx/fswatcher.h
wx/generic/fswatcher.h
wx/unix/app.h