Skip to content

[lib] Ensure non-member swap is declared in the header synopsis only #4448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 0 additions & 75 deletions source/containers.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3767,11 +3767,6 @@
template<class InputIterator, class Allocator = allocator<@\placeholder{iter-value-type}@<InputIterator>>>
deque(InputIterator, InputIterator, Allocator = Allocator())
-> deque<@\placeholder{iter-value-type}@<InputIterator>, Allocator>;

// swap
template<class T, class Allocator>
void swap(deque<T, Allocator>& x, deque<T, Allocator>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -4207,11 +4202,6 @@
template<class InputIterator, class Allocator = allocator<@\placeholder{iter-value-type}@<InputIterator>>>
forward_list(InputIterator, InputIterator, Allocator = Allocator())
-> forward_list<@\placeholder{iter-value-type}@<InputIterator>, Allocator>;

// swap
template<class T, class Allocator>
void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -5004,11 +4994,6 @@
template<class InputIterator, class Allocator = allocator<@\placeholder{iter-value-type}@<InputIterator>>>
list(InputIterator, InputIterator, Allocator = Allocator())
-> list<@\placeholder{iter-value-type}@<InputIterator>, Allocator>;

// swap
template<class T, class Allocator>
void swap(list<T, Allocator>& x, list<T, Allocator>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -5697,11 +5682,6 @@
template<class InputIterator, class Allocator = allocator<@\placeholder{iter-value-type}@<InputIterator>>>
vector(InputIterator, InputIterator, Allocator = Allocator())
-> vector<@\placeholder{iter-value-type}@<InputIterator>, Allocator>;

// swap
template<class T, class Allocator>
constexpr void swap(vector<T, Allocator>& x, vector<T, Allocator>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}%
\indexlibrarymember{vector}{operator==}%
Expand Down Expand Up @@ -6684,12 +6664,6 @@

template<class Key, class T, class Allocator>
map(initializer_list<pair<Key, T>>, Allocator) -> map<Key, T, less<Key>, Allocator>;

// swap
template<class Key, class T, class Compare, class Allocator>
void swap(map<Key, T, Compare, Allocator>& x,
map<Key, T, Compare, Allocator>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -7214,12 +7188,6 @@
template<class Key, class T, class Allocator>
multimap(initializer_list<pair<Key, T>>, Allocator)
-> multimap<Key, T, less<Key>, Allocator>;

// swap
template<class Key, class T, class Compare, class Allocator>
void swap(multimap<Key, T, Compare, Allocator>& x,
multimap<Key, T, Compare, Allocator>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}%
\indexlibrarymember{multimap}{operator==}%
Expand Down Expand Up @@ -7519,12 +7487,6 @@

template<class Key, class Allocator>
set(initializer_list<Key>, Allocator) -> set<Key, less<Key>, Allocator>;

// swap
template<class Key, class Compare, class Allocator>
void swap(set<Key, Compare, Allocator>& x,
set<Key, Compare, Allocator>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}%
\indexlibrarymember{set}{operator==}%
Expand Down Expand Up @@ -7799,12 +7761,6 @@

template<class Key, class Allocator>
multiset(initializer_list<Key>, Allocator) -> multiset<Key, less<Key>, Allocator>;

// swap
template<class Key, class Compare, class Allocator>
void swap(multiset<Key, Compare, Allocator>& x,
multiset<Key, Compare, Allocator>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}%
\indexlibrarymember{multiset}{operator==}%
Expand Down Expand Up @@ -8297,12 +8253,6 @@
unordered_map(initializer_list<pair<Key, T>>, typename @\seebelow@::size_type, Hash,
Allocator)
-> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>;

// swap
template<class Key, class T, class Hash, class Pred, class Alloc>
void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
unordered_map<Key, T, Hash, Pred, Alloc>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -8876,12 +8826,6 @@
unordered_multimap(initializer_list<pair<Key, T>>, typename @\seebelow@::size_type,
Hash, Allocator)
-> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>;

// swap
template<class Key, class T, class Hash, class Pred, class Alloc>
void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -9235,12 +9179,6 @@
template<class T, class Hash, class Allocator>
unordered_set(initializer_list<T>, typename @\seebelow@::size_type, Hash, Allocator)
-> unordered_set<T, Hash, equal_to<T>, Allocator>;

// swap
template<class Key, class Hash, class Pred, class Alloc>
void swap(unordered_set<Key, Hash, Pred, Alloc>& x,
unordered_set<Key, Hash, Pred, Alloc>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -9566,12 +9504,6 @@
template<class T, class Hash, class Allocator>
unordered_multiset(initializer_list<T>, typename @\seebelow@::size_type, Hash, Allocator)
-> unordered_multiset<T, Hash, equal_to<T>, Allocator>;

// swap
template<class Key, class Hash, class Pred, class Alloc>
void swap(unordered_multiset<Key, Hash, Pred, Alloc>& x,
unordered_multiset<Key, Hash, Pred, Alloc>& y)
noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -9839,9 +9771,6 @@
template<class Container, class Allocator>
queue(Container, Allocator) -> queue<typename Container::value_type, Container>;

template<class T, class Container>
void swap(queue<T, Container>& x, queue<T, Container>& y) noexcept(noexcept(x.swap(y)));

template<class T, class Container, class Alloc>
struct uses_allocator<queue<T, Container>, Alloc>
: uses_allocator<Container, Alloc>::type { };
Expand Down Expand Up @@ -10123,10 +10052,6 @@

// no equality is provided

template<class T, class Container, class Compare>
void swap(priority_queue<T, Container, Compare>& x,
priority_queue<T, Container, Compare>& y) noexcept(noexcept(x.swap(y)));

template<class T, class Container, class Compare, class Alloc>
struct uses_allocator<priority_queue<T, Container, Compare>, Alloc>
: uses_allocator<Container, Alloc>::type { };
Expand Down
76 changes: 39 additions & 37 deletions source/iostreams.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7471,25 +7471,43 @@
class Allocator = allocator<charT>>
class basic_stringbuf;

template<class charT, class traits, class Allocator>
void swap(basic_stringbuf<charT, traits, Allocator>& x,
basic_stringbuf<charT, traits, Allocator>& y) noexcept(noexcept(x.swap(y)));

using stringbuf = basic_stringbuf<char>;
using wstringbuf = basic_stringbuf<wchar_t>;

template<class charT, class traits = char_traits<charT>,
class Allocator = allocator<charT>>
class basic_istringstream;

template<class charT, class traits, class Allocator>
void swap(basic_istringstream<charT, traits, Allocator>& x,
basic_istringstream<charT, traits, Allocator>& y);

using istringstream = basic_istringstream<char>;
using wistringstream = basic_istringstream<wchar_t>;

template<class charT, class traits = char_traits<charT>,
class Allocator = allocator<charT>>
class basic_ostringstream;

template<class charT, class traits, class Allocator>
void swap(basic_ostringstream<charT, traits, Allocator>& x,
basic_ostringstream<charT, traits, Allocator>& y);

using ostringstream = basic_ostringstream<char>;
using wostringstream = basic_ostringstream<wchar_t>;

template<class charT, class traits = char_traits<charT>,
class Allocator = allocator<charT>>
class basic_stringstream;

template<class charT, class traits, class Allocator>
void swap(basic_stringstream<charT, traits, Allocator>& x,
basic_stringstream<charT, traits, Allocator>& y);

using stringstream = basic_stringstream<char>;
using wstringstream = basic_stringstream<wchar_t>;
}
Expand Down Expand Up @@ -7585,10 +7603,6 @@
basic_string<charT, traits, Allocator> buf; // \expos
void init_buf_ptrs(); // \expos
};

template<class charT, class traits, class Allocator>
void swap(basic_stringbuf<charT, traits, Allocator>& x,
basic_stringbuf<charT, traits, Allocator>& y) noexcept(noexcept(x.swap(y)));
}
\end{codeblock}

Expand Down Expand Up @@ -8368,10 +8382,6 @@
private:
basic_stringbuf<charT, traits, Allocator> sb; // \expos
};

template<class charT, class traits, class Allocator>
void swap(basic_istringstream<charT, traits, Allocator>& x,
basic_istringstream<charT, traits, Allocator>& y);
}
\end{codeblock}

Expand Down Expand Up @@ -8687,10 +8697,6 @@
private:
basic_stringbuf<charT, traits, Allocator> sb; // \expos
};

template<class charT, class traits, class Allocator>
void swap(basic_ostringstream<charT, traits, Allocator>& x,
basic_ostringstream<charT, traits, Allocator>& y);
}
\end{codeblock}

Expand Down Expand Up @@ -9010,10 +9016,6 @@
private:
basic_stringbuf<charT, traits> sb; // \expos
};

template<class charT, class traits, class Allocator>
void swap(basic_stringstream<charT, traits, Allocator>& x,
basic_stringstream<charT, traits, Allocator>& y);
}
\end{codeblock}

Expand Down Expand Up @@ -9298,21 +9300,37 @@
namespace std {
template<class charT, class traits = char_traits<charT>>
class basic_filebuf;

template<class charT, class traits>
void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);

using filebuf = basic_filebuf<char>;
using wfilebuf = basic_filebuf<wchar_t>;

template<class charT, class traits = char_traits<charT>>
class basic_ifstream;

template<class charT, class traits>
void swap(basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y);

using ifstream = basic_ifstream<char>;
using wifstream = basic_ifstream<wchar_t>;

template<class charT, class traits = char_traits<charT>>
class basic_ofstream;

template<class charT, class traits>
void swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);

using ofstream = basic_ofstream<char>;
using wofstream = basic_ofstream<wchar_t>;

template<class charT, class traits = char_traits<charT>>
class basic_fstream;

template<class charT, class traits>
void swap(basic_fstream<charT, traits>& x, basic_fstream<charT, traits>& y);

using fstream = basic_fstream<char>;
using wfstream = basic_fstream<wchar_t>;
}
Expand Down Expand Up @@ -9396,10 +9414,6 @@
int sync() override;
void imbue(const locale& loc) override;
};

template<class charT, class traits>
void swap(basic_filebuf<charT, traits>& x,
basic_filebuf<charT, traits>& y);
}
\end{codeblock}

Expand Down Expand Up @@ -10157,10 +10171,6 @@
private:
basic_filebuf<charT, traits> sb; // \expos
};

template<class charT, class traits>
void swap(basic_ifstream<charT, traits>& x,
basic_ifstream<charT, traits>& y);
}
\end{codeblock}

Expand Down Expand Up @@ -10392,10 +10402,6 @@
private:
basic_filebuf<charT, traits> sb; // \expos
};

template<class charT, class traits>
void swap(basic_ofstream<charT, traits>& x,
basic_ofstream<charT, traits>& y);
}
\end{codeblock}

Expand Down Expand Up @@ -10636,10 +10642,6 @@
private:
basic_filebuf<charT, traits> sb; // \expos
};

template<class charT, class traits>
void swap(basic_fstream<charT, traits>& x,
basic_fstream<charT, traits>& y);
}
\end{codeblock}

Expand Down Expand Up @@ -10850,6 +10852,11 @@
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
class basic_syncbuf;

// \ref{syncstream.syncbuf.special}, specialized algorithms
template<class charT, class traits, class Allocator>
void swap(basic_syncbuf<charT, traits, Allocator>&,
basic_syncbuf<charT, traits, Allocator>&);

using syncbuf = basic_syncbuf<char>;
using wsyncbuf = basic_syncbuf<wchar_t>;

Expand Down Expand Up @@ -10911,11 +10918,6 @@
streambuf_type* wrapped; // \expos
bool emit_on_sync{}; // \expos
};

// \ref{syncstream.syncbuf.special}, specialized algorithms
template<class charT, class traits, class Allocator>
void swap(basic_syncbuf<charT, traits, Allocator>&,
basic_syncbuf<charT, traits, Allocator>&);
}
\end{codeblock}

Expand Down
Loading