diff options
Diffstat (limited to 'docs/checks/README-detaching-temporary.md')
-rw-r--r-- | docs/checks/README-detaching-temporary.md | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/checks/README-detaching-temporary.md b/docs/checks/README-detaching-temporary.md new file mode 100644 index 00000000..60d0196c --- /dev/null +++ b/docs/checks/README-detaching-temporary.md @@ -0,0 +1,7 @@ +# detaching-temporary + +Finds places where you're calling non-const member functions on temporaries. +For example `getList().first()`, which would detach if the container is shared. + +There can be some false-positives, for example `someHash.values().first()` because refcount is 1. +But `constFirst()` is a good default, so you should try to use it wherever you can, since it's not practical to inspect all code and figure out if the container is shared or not. |