From 32753ae949d861ddaf7c66f4c483bc57493c6c6c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Oct 2012 12:02:00 +0000 Subject: [PATCH] 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 --- Makefile.in | 2 ++ build/bakefiles/files.bkl | 1 + build/msw/wx_base.dsp | 4 ++++ build/msw/wx_vc7_base.vcproj | 3 +++ build/msw/wx_vc8_base.vcproj | 4 ++++ build/msw/wx_vc9_base.vcproj | 4 ++++ include/wx/meta/removeref.h | 29 +++++++++++++++++++++++++++++ wxGTK.spec | 1 + wxMotif.spec | 1 + wxX11.spec | 1 + 10 files changed, 50 insertions(+) create mode 100644 include/wx/meta/removeref.h diff --git a/Makefile.in b/Makefile.in index ce7fc8ac94..b47f71ca2e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 \ diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 5a3bbffc34..7864c47ad8 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -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 diff --git a/build/msw/wx_base.dsp b/build/msw/wx_base.dsp index 1c26b4ad90..9bfbf02063 100644 --- a/build/msw/wx_base.dsp +++ b/build/msw/wx_base.dsp @@ -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 diff --git a/build/msw/wx_vc7_base.vcproj b/build/msw/wx_vc7_base.vcproj index 9bea660b61..6b9cb0d6d0 100644 --- a/build/msw/wx_vc7_base.vcproj +++ b/build/msw/wx_vc7_base.vcproj @@ -1530,6 +1530,9 @@ + + diff --git a/build/msw/wx_vc8_base.vcproj b/build/msw/wx_vc8_base.vcproj index bc4673176f..a6faa00526 100644 --- a/build/msw/wx_vc8_base.vcproj +++ b/build/msw/wx_vc8_base.vcproj @@ -2061,6 +2061,10 @@ RelativePath="..\..\include\wx\regex.h" > + + diff --git a/build/msw/wx_vc9_base.vcproj b/build/msw/wx_vc9_base.vcproj index 20d75fc9f6..6cee41d20d 100644 --- a/build/msw/wx_vc9_base.vcproj +++ b/build/msw/wx_vc9_base.vcproj @@ -2057,6 +2057,10 @@ RelativePath="..\..\include\wx\regex.h" > + + diff --git a/include/wx/meta/removeref.h b/include/wx/meta/removeref.h new file mode 100644 index 0000000000..5c32c3349e --- /dev/null +++ b/include/wx/meta/removeref.h @@ -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 +// 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 +struct wxRemoveRef +{ + typedef T type; +}; + +template +struct wxRemoveRef +{ + typedef T type; +}; + +#endif // _WX_META_REMOVEREF_H_ diff --git a/wxGTK.spec b/wxGTK.spec index b4c4e4956f..eb2a1590f6 100644 --- a/wxGTK.spec +++ b/wxGTK.spec @@ -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 diff --git a/wxMotif.spec b/wxMotif.spec index 790c396d0d..2ef607bbff 100644 --- a/wxMotif.spec +++ b/wxMotif.spec @@ -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 diff --git a/wxX11.spec b/wxX11.spec index 335e3eaba3..012b91db5f 100644 --- a/wxX11.spec +++ b/wxX11.spec @@ -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