]> git.saurik.com Git - wxWidgets.git/commitdiff
store the value to be set inside wxON_BLOCK_EXIT_SET(), this allows to use temporarie...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 19 Nov 2008 12:06:17 +0000 (12:06 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 19 Nov 2008 12:06:17 +0000 (12:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/scopeguard.h
interface/wx/scopeguard.h

index baa33fb799d78ef4f776b43ed40d2062016c11d3..da056e08db59b526b4637f69a7289b014164ead2 100644 (file)
@@ -411,7 +411,7 @@ template <typename T, typename U>
 class VariableSetterImpl : public VariableSetterBase
 {
 public:
-    VariableSetterImpl(T& var, const U& value)
+    VariableSetterImpl(T& var, U value)
         : m_var(var),
           m_value(value)
     {
@@ -424,7 +424,7 @@ public:
 
 private:
     T& m_var;
-    const U& m_value;
+    const U m_value;
 
     // suppress the warning about assignment operator not being generated
     VariableSetterImpl<T, U>& operator=(const VariableSetterImpl<T, U>&);
@@ -454,7 +454,7 @@ private:
 
 template <typename T, typename U>
 inline
-wxPrivate::VariableSetterImpl<T, U> wxMakeVarSetter(T& var, const U& value)
+wxPrivate::VariableSetterImpl<T, U> wxMakeVarSetter(T& var, U value)
 {
       return wxPrivate::VariableSetterImpl<T, U>(var, value);
 }
index 55ea677e2290e813b4fbba0c439f56b650b38097..01887eb6039cb97eff96c82828140dd26ed6d0f7 100644 (file)
@@ -131,6 +131,9 @@ wxScopeGuard wxMakeGuard(F func, P1 p1, ..., PN pN);
     }
     @endcode
 
+    Notice that @a value is copied, i.e. stored by value, so it can be a
+    temporary object returned by a function call, for example.
+
     @see wxON_BLOCK_EXIT_OBJ0(), wxON_BLOCK_EXIT_NULL()
 
     @header{wx/scopeguard.h}