Skip to content

Commit 53d02a2

Browse files
committed
Fixed compilation of readme code and simplify it
1 parent f121b7f commit 53d02a2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ From there, include the single header `<oup/observable_unique_ptr.hpp>`, and dir
2121
```c++
2222
#include <oup/observable_unique_ptr.hpp>
2323

24+
#include <string>
25+
#include <iostream>
26+
#include <cassert>
27+
2428
int main() {
2529
// Weak pointer that will outlive the object
2630
oup::weak_ptr<std::string> wptr;
@@ -41,10 +45,10 @@ int main() {
4145
std::cout << *s << std::endl;
4246

4347
// The unique pointer cannot be copied
44-
oup::observable_unique_ptr<std::string> tmp_copied = ptr; // error!
48+
auto tmp_copied = ptr; // error!
4549

4650
// ... but it can be moved
47-
oup::observable_unique_ptr<std::string> tmp_moved = std::move(ptr); // OK
51+
auto tmp_moved = std::move(ptr); // OK
4852
}
4953

5054
// The unique pointer has gone out of scope, the object is deleted,

0 commit comments

Comments
 (0)