stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: test for lig.alg.swap
Date Wed, 18 Jan 2006 01:59:42 GMT
Anton Pevtsov wrote:
> The attached file contains my attempt to update lib.alg.swap tests and
> port them to new test driver.

Thanks! Your idea of reducing code duplication is neat. Unfortunately,
there is a problem with it that prevents us from taking advantage of
it in its current form: the library is designed to handle compilers
that do not provide support or fully implement member templates (the
configuration macro _RWSTD_NO_MEMBER_TEMPLATES). Thus the testsuite
cannot assume that member templates are supported.


> // classes used to exercise swap functions and to reduce code lines
> struct TestIterSwap
> {
>     TestIterSwap (int dummy) : dummy_(dummy) {}
>     template <class T, class ForwardIterator1, class ForwardIterator2>
>     void test_swap (ForwardIterator1 it1, ForwardIterator2 it2, const T* )

This is the problem. But I think we should be able to deal with it
quite easily. We don't need member templates to avoid code duplication
-- a simple

     if (test_swap_ranges)
         test_swap_ranges (it1, it2, (T*)0);
         test_iter_swap (it1, it2, (T*)0, true);

in a new simple forwarding function called from the first overload
of test_swap() should do, don't you think?


View raw message