stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: structure of tuple tests ([Fwd: Re: svn commit: r675044 - in /stdcxx/branches/4.3.x: include/rw/_tuple.h include/tuple tests/utilities/20.tuple.cnstr.cpp tests/utilities/20.tuple.creation.cpp tests/utilities/20.tuple.h tests/utilities/20.tuple.helpers
Date Thu, 17 Jul 2008 17:00:35 GMT
Eric Lemings wrote:
>  
> 
>> -----Original Message-----
>> From: Eric Lemings 
>> Sent: Thursday, July 17, 2008 9:24 AM
>> To: 'dev@stdcxx.apache.org'
>> Subject: RE: structure of tuple tests ([Fwd: Re: svn commit: 
>> r675044 - in /stdcxx/branches/4.3.x: include/rw/_tuple.h 
>> include/tuple tests/utilities/20.tuple.cnstr.cpp 
>> tests/utilities/20.tuple.creation.cpp 
>> tests/utilities/20.tuple.h tests/utilities/20.tuple.helpers
>>
>>  
>>
>>> -----Original Message-----
>>> From: Eric Lemings 
>>> Sent: Thursday, July 17, 2008 8:47 AM
>>> To: 'dev@stdcxx.apache.org'
>>> Subject: RE: structure of tuple tests ([Fwd: Re: svn commit: 
>>> r675044 - in /stdcxx/branches/4.3.x: include/rw/_tuple.h 
>>> include/tuple tests/utilities/20.tuple.cnstr.cpp 
>>> tests/utilities/20.tuple.creation.cpp 
>>> tests/utilities/20.tuple.h tests/utilities/20.tuple.helpers
>>>
>>>  
>> ...
>>>> In 20.tuple.cnstr.cpp you might also be able to get rid of
>>>> <cstring> by using rw_strncmp(). You should also be able
>>>> to use rw_equal() instead of defining a special helper (if
>>>> rw_equal() doesn't do something we need to do in the tuple
>>>> tests maybe we could extend it?)
>>> Was not aware of those.  I'll try to reuse them.
>> I believe this is a safe enhancement to rw_equal() but I just 
>> wanna make sure:
>>
>> template <class T, class U = T>
>> inline int rw_equal (T x, U y)
>> {
>>     return x == y;
>> }
>>
>> This would allow comparison of different but compatible types 
>> which is needed for heterogenous tuple types.  Anyone see a 
>> problem with it?
> 
> One problem with rw_equal(), as it relates to tuple tests, is that the
> arguments are copied.  This poses a problem for user-defined types (esp.
> UserDefined) which keeps track of and more importantly tests such
> things.
> 
> I don't think it would be possible to change rw_equal() as follows:
> 
> template <class T, class U = T>
> inline bool rw_equal (const T& x, const U& y)
> {
>     return x == y;
> }
> 
> Or would it?

I can't think of a reason why not (except for the default
template argument -- they're not allowed on functions; but
here the default isn't necessary).

> 
> Brad.


Mime
View raw message