[RFC] how to test for swap specializations?
Gabriel Dos Reis
gdr@integrable-solutions.net
Tue Mar 2 00:46:00 GMT 2004
Benjamin Kosnik <bkoz@redhat.com> writes:
| Anybody have any ideas on how to test for this? (It's what is left of
| libstdc++/13658)
|
| #include <vector>
|
| int main()
| {
| // Should use vector specialization for swap, and does not.
| {
| std::vector<int> A;
| std::vector<int> B;
| std::swap(A, B);
Random idea. Is the following going to test the "same thing"?
struct foo { };
namespace std {
template<>
struct vector<foo> {
// no swap() member
};
}
int main()
{
std::vector<foo> A;
std::vector<foo> B;
std::swap(A, B); // ERROR
}
The test fails if there is no error, for the specialization of
std::swap() for std::vector<> would not have been called.
-- Gaby
More information about the Libstdc++
mailing list