From 81c10b8017a987b777484e7b6470b231a6acfc6b Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Tue, 22 Dec 2020 17:04:07 -0800 Subject: [PATCH] `normalize` is a more accurate name than `sanitize` --- include/gsl/assert | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/gsl/assert b/include/gsl/assert index cedad0b..86671f0 100644 --- a/include/gsl/assert +++ b/include/gsl/assert @@ -106,16 +106,14 @@ public: #else // VESTIGIAL, remove when no longer needed for downlevel compilers using handler = void (*)(); #endif - - constexpr contract_group (handler h = nullptr) : chandler(sanitize(h)) { } - constexpr auto set_handler(handler h) -> handler { auto old = chandler; chandler = sanitize(h); return old; } + constexpr contract_group (handler h = nullptr) : chandler(normalize(h)) { } + constexpr auto set_handler(handler h) -> handler { auto old = chandler; chandler = normalize(h); return old; } constexpr auto get_handler() const -> handler { return chandler; } - - constexpr void expects (bool b) { assertion(b); } - constexpr void ensures (bool b) { assertion(b); } + constexpr auto expects (bool b) -> void { assertion(b); } + constexpr auto ensures (bool b) -> void { assertion(b); } private: - constexpr void assertion(bool b) { if (!b) chandler(); } - constexpr auto sanitize(handler h) -> handler { return h ? h : []()noexcept{}; } + constexpr auto assertion(bool b) -> void { if (!b) chandler(); } + constexpr auto normalize(handler h) -> handler { return h ? h : []()noexcept{}; } handler chandler; };