From 937488887fd973bd0f721ac166a96c8c3a0d8356 Mon Sep 17 00:00:00 2001 From: Titus Winters Date: Tue, 17 Nov 2015 16:22:21 -0500 Subject: [PATCH] Don't ruin the complexity of your interface with checking. --- CppCoreGuidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 7ccb8a2..43aba4f 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -749,7 +749,7 @@ The date is validated twice (by the `Date` constructor) and passed as a characte ##### Example Excess checking can be costly. -There are cases where checking early is dumb because you may not ever need the value, or may only need part of the value that is more easily checked than the whole. +There are cases where checking early is dumb because you may not ever need the value, or may only need part of the value that is more easily checked than the whole. Similarly, don't add validity checks that change the asymptotic behavior of your interface (e.g., don't add a `O(1)` check to an interface with an average complexity of `O(1)`). class Jet { // Physics says: e*e < x*x + y*y + z*z