stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r544831 - /incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp
Date Tue, 14 Aug 2007 16:32:56 GMT
faridz@apache.org wrote:
> Author: faridz
> Date: Wed Jun  6 06:03:48 2007
> New Revision: 544831
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=544831
> Log:
> 2007-06-06 Farid Zaripov <Farid_Zaripov@epam.com>
> 
> 	* dynatype.cpp (copy): static_cast to const T& instead of T

Why is this an improvement over the original?

If it's a workaround for a bug in some compiler (MSVC?) please
remember to a) add a comment to that effect above the expression
so that the next person to work on the code doesn't inadvertently
revert it, and b) document the same in the ChangeLog entry for
the benefit of others. Otherwise, if it's not a workaround but
rather an efficiency improvement, just say so in the ChangeLog.

Thanks!
Martin

> 
> Modified:
>     incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp
> 
> Modified: incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp
> URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp?view=diff&rev=544831&r1=544830&r2=544831
> ==============================================================================
> --- incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp (original)
> +++ incubator/stdcxx/trunk/examples/tutorial/dynatype.cpp Wed Jun  6 06:03:48 2007
> @@ -58,7 +58,7 @@
>      // helper: copies one instance of dynatype to another
>      template <class T>
>      void copy (const dynatype &rhs) {
> -        *this = static_cast<T>(rhs);
> +        *this = static_cast<const T&>(rhs);
>      }
>  
>      // pointers to the helpers (do not depend on a template parameter)
> 
> 


Mime
View raw message