Skip to content

Commit

Permalink
Update CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate authored Jul 15, 2022
1 parent b64757c commit 4287f92
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,13 @@ void templateFunc(Type value) {

std::shared_ptr<MyType> globalFunc(std::string const &arg) { // this function is visible globally
auto ret = staticFunc(arg);
if (ret.size() > 42) { // have space between 'if' and '('
if (ret.size() > 42) { // have space between 'if' and '('
return nullptr;
}
auto ptr = std::make_shared<MyType>(); // use smart pointers instead of naked new/delete
ptr->some_attr = std::move(ret); // use std::move for optimal zero-copying
auto ptr = std::make_shared<MyType>(); // use smart pointers instead of naked new/delete
// std::shared_ptr<MyType> ptr(new MyType); // DO NOT USE THIS, use make_shared/make_unique instead

ptr->some_attr = std::move(ret); // use std::move for optimal zero-copying
return ptr;
}

Expand Down

0 comments on commit 4287f92

Please sign in to comment.