Fix whitespace around operator

This commit is contained in:
Thibault Kruse
2016-04-23 14:16:59 +02:00
parent da92068a5f
commit d7bab1ab0f

View File

@@ -2239,8 +2239,13 @@ Passing a shared smart pointer (e.g., `std::shared_ptr`) implies a run-time cost
##### Example ##### Example
void f(int*); // accepts any int* // accepts any int*
void f(int*);
// can only accept ints for which you want to transfer ownership
void g(unique_ptr<int>); // accepts ints to transfer ownership void g(unique_ptr<int>); // accepts ints to transfer ownership
// can only accept ints for which you are willing to share ownership
void g(shared_ptr<int>); // accepts ints to share ownership void g(shared_ptr<int>); // accepts ints to share ownership
// doesnt change ownership, but requires a particular ownership of the caller // doesnt change ownership, but requires a particular ownership of the caller
@@ -2683,10 +2688,13 @@ A `span` represents a range of elements, but how do we manipulate elements of th
{ {
// range traversal (guaranteed correct) // range traversal (guaranteed correct)
for (int x : s) cout << x << '\n'; for (int x : s) cout << x << '\n';
// C-style traversal (potentially checked) // C-style traversal (potentially checked)
for (int i = 0; i < s.size(); ++i) cout << x << '\n'; for (int i = 0; i < s.size(); ++i) cout << x << '\n';
// random access (potentially checked) // random access (potentially checked)
s[7] = 9; s[7] = 9;
// extract pointers (potentially checked) // extract pointers (potentially checked)
std::sort(&s[0], &s[s.size() / 2]); std::sort(&s[0], &s[s.size() / 2]);
} }
@@ -4064,7 +4072,9 @@ If the `Handle` owns the object referred to by `s` it must have a destructor.
Independently of whether `Handle` owns its `Shape`, we must consider the default copy operations suspect: Independently of whether `Handle` owns its `Shape`, we must consider the default copy operations suspect:
Handle x {*new Circle{p1, 17}}; // causes a leak if the Handle is not a Circle // the Handle had better own the Circle or we have a leak
Handle x {*new Circle{p1, 17}};
Handle y {*new Triangle{p1, p2, p3}}; Handle y {*new Triangle{p1, p2, p3}};
x = y; // the default assignment will try *x.s = *y.s x = y; // the default assignment will try *x.s = *y.s