From 7757e7ec9f7d7bfe7fffd9b1ca9d884ca356f262 Mon Sep 17 00:00:00 2001 From: Zac Hansen Date: Thu, 29 Mar 2018 20:50:36 -0700 Subject: [PATCH] remove null check during access --- include/gsl/pointers | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/gsl/pointers b/include/gsl/pointers index b2804a3..0389b76 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -88,7 +88,12 @@ public: constexpr T get() const { - Ensures(ptr_ != nullptr); + /* + not_null constructors and assignment operators always verify ptr_ is + not set to null. As long as references to ptr_ are not exposed publicly + it is not additionally necessary to check the value against nullptr here. + */ + // Ensures(ptr_ != nullptr); return ptr_; }