This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Remove invalid test on non-const empty strings

Jonathan Wakely wrote:

On a related note, there are a bunch of tests to check that the specialisations of swap work. These don't appear to work on the

>I reported these as

Ah, this bug is already submitted. I should have looked for that. Sorry!

debugging library, and also make me nervous as they are adding overloads of member functions of elements of std. It seems their purpose is to check that the O(1) swap is being called. Wouldn't therefore something like:
<snip code>
Test the same thing, and not require adding overloads?

They're specialisations, not overloads, so are absolutely fine. It's legal to add specialisation to namespace std for stdlib components with user-defined types as template arguments. The point is to test that std::swap<std::deque<T> >() calls std::deque<T>::swap(), which I don't think your code above does - it assumes that the default specialisation of std::swap() will cause copies of the elements, but it's possible it could be implemented purely in terms of assigments (however unlikely that may be).

Well, I could overload both copy constructor and assignment then :)

If adding overloads to std is valid however then really the test / code needs fixing anyway, as you say, as this is something which can legally be done. I am somewhat suprised people are allowed to add overloads here, but if thats what the standard says, so be it!



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]