Run clang-format
This commit is contained in:
@@ -1,29 +1,33 @@
|
||||
#include <mutex>
|
||||
|
||||
class some_big_object
|
||||
{};
|
||||
|
||||
void swap(some_big_object& lhs,some_big_object& rhs)
|
||||
{}
|
||||
|
||||
class X
|
||||
{
|
||||
private:
|
||||
some_big_object some_detail;
|
||||
mutable std::mutex m;
|
||||
public:
|
||||
X(some_big_object const& sd):some_detail(sd){}
|
||||
|
||||
friend void swap(X& lhs, X& rhs)
|
||||
{
|
||||
if(&lhs==&rhs)
|
||||
return;
|
||||
std::unique_lock<std::mutex> lock_a(lhs.m,std::defer_lock);
|
||||
std::unique_lock<std::mutex> lock_b(rhs.m,std::defer_lock);
|
||||
std::lock(lock_a,lock_b);
|
||||
swap(lhs.some_detail,rhs.some_detail);
|
||||
}
|
||||
class some_big_object {
|
||||
};
|
||||
|
||||
int main()
|
||||
{}
|
||||
void
|
||||
swap(some_big_object& lhs, some_big_object& rhs)
|
||||
{
|
||||
}
|
||||
|
||||
class X {
|
||||
private:
|
||||
some_big_object some_detail;
|
||||
mutable std::mutex m;
|
||||
|
||||
public:
|
||||
X(some_big_object const& sd) : some_detail(sd) {}
|
||||
|
||||
friend void swap(X& lhs, X& rhs)
|
||||
{
|
||||
if (&lhs == &rhs)
|
||||
return;
|
||||
std::unique_lock<std::mutex> lock_a(lhs.m, std::defer_lock);
|
||||
std::unique_lock<std::mutex> lock_b(rhs.m, std::defer_lock);
|
||||
std::lock(lock_a, lock_b);
|
||||
swap(lhs.some_detail, rhs.some_detail);
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user