aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-11-02 15:20:29 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-11-13 10:42:27 -0800
commit1ab86305c15fe0ab080282e83b07e24ebb0f0bb7 (patch)
tree954453f50ac1b9a33bee667d69c852e5dee7b82d
parentde4d0c0867efee1e81809ce0e4b6c8f7557c958e (diff)
downloaduhd-1ab86305c15fe0ab080282e83b07e24ebb0f0bb7.tar.gz
uhd-1ab86305c15fe0ab080282e83b07e24ebb0f0bb7.tar.bz2
uhd-1ab86305c15fe0ab080282e83b07e24ebb0f0bb7.zip
coding guidelines: Add .at() vs [] comment
-rw-r--r--CODING.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/CODING.md b/CODING.md
index 774e7d079..7b2dda931 100644
--- a/CODING.md
+++ b/CODING.md
@@ -84,6 +84,11 @@ Date: Tue Nov 22 16:19:38 2016 -0800
Reviewed-By: Martin Braun <martin.braun@ettus.com>
```
+* Prefer `.at()` over `[]` for maps and vectors. Keep in mind that `[]` will
+ invoke a default constructor of the value type, whereas `.at()` will throw
+ an exception if the index doesn't exist -- which is usually the desired
+ behaviour.
+
## Boost-specific Guidelines