mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Added swap_test_class swap functions to test/swap_arrays.cpp. My fault, they should have been there already!
[SVN r47628]
This commit is contained in:
parent
ece6992540
commit
64a0e0cb20
@ -11,6 +11,25 @@
|
|||||||
//Put test class in the global namespace
|
//Put test class in the global namespace
|
||||||
#include "./swap_test_class.hpp"
|
#include "./swap_test_class.hpp"
|
||||||
|
|
||||||
|
//Provide swap function in both the namespace of swap_test_class
|
||||||
|
//(which is the global namespace), and the std namespace.
|
||||||
|
//It's common to provide a swap function for a class in both
|
||||||
|
//namespaces. Scott Meyers recommends doing so: Effectice C++,
|
||||||
|
//Third Edition, item 25, "Consider support for a non-throwing swap".
|
||||||
|
void swap(swap_test_class& left, swap_test_class& right)
|
||||||
|
{
|
||||||
|
left.swap(right);
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
template <>
|
||||||
|
void swap(swap_test_class& left, swap_test_class& right)
|
||||||
|
{
|
||||||
|
left.swap(right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_main(int, char*[])
|
int test_main(int, char*[])
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user