From 6e2e207c8d117c5ec5b151ec822fa39e280f7c3e Mon Sep 17 00:00:00 2001 From: Tiago Date: Tue, 28 Nov 2017 07:20:32 -0800 Subject: [PATCH] rename final_act to final_action (#579) --- include/gsl/gsl_util | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/gsl/gsl_util b/include/gsl/gsl_util index caf56d8..40e2229 100644 --- a/include/gsl/gsl_util +++ b/include/gsl/gsl_util @@ -43,22 +43,22 @@ namespace gsl // GSL.util: utilities // -// final_act allows you to ensure something gets run at the end of a scope +// final_action allows you to ensure something gets run at the end of a scope template -class final_act +class final_action { public: - explicit final_act(F f) noexcept : f_(std::move(f)), invoke_(true) {} + explicit final_action(F f) noexcept : f_(std::move(f)), invoke_(true) {} - final_act(final_act&& other) noexcept : f_(std::move(other.f_)), invoke_(other.invoke_) + final_action(final_action&& other) noexcept : f_(std::move(other.f_)), invoke_(other.invoke_) { other.invoke_ = false; } - final_act(const final_act&) = delete; - final_act& operator=(const final_act&) = delete; + final_action(const final_action&) = delete; + final_action& operator=(const final_action&) = delete; - ~final_act() noexcept + ~final_action() noexcept { if (invoke_) f_(); } @@ -68,17 +68,17 @@ private: bool invoke_; }; -// finally() - convenience function to generate a final_act +// finally() - convenience function to generate a final_action template -inline final_act finally(const F& f) noexcept +inline final_action finally(const F& f) noexcept { - return final_act(f); + return final_action(f); } template -inline final_act finally(F&& f) noexcept +inline final_action finally(F&& f) noexcept { - return final_act(std::forward(f)); + return final_action(std::forward(f)); } // narrow_cast(): a searchable way to do narrowing casts of values