mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-16 20:27:08 +03:00
book: fmt
This commit is contained in:
@@ -36,12 +36,10 @@ And return the `std::shared_ptr` pointer of this object type. For example:
|
||||
```cpp
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
void foo(std::shared_ptr<int> i)
|
||||
{
|
||||
void foo(std::shared_ptr<int> i) {
|
||||
(*i)++;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// auto pointer = new int(10); // illegal, no direct assignment
|
||||
// Constructed a std::shared_ptr
|
||||
auto pointer = std::make_shared<int>(10);
|
||||
|
||||
@@ -38,12 +38,10 @@ order: 5
|
||||
```cpp
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
void foo(std::shared_ptr<int> i)
|
||||
{
|
||||
void foo(std::shared_ptr<int> i) {
|
||||
(*i)++;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// auto pointer = new int(10); // illegal, no direct assignment
|
||||
// Constructed a std::shared_ptr
|
||||
auto pointer = std::make_shared<int>(10);
|
||||
|
||||
Reference in New Issue
Block a user