macro version

This commit is contained in:
Jordan Maples 2020-08-10 16:45:47 -07:00
parent 63379b7935
commit 01eaf5bef1

View File

@ -32,6 +32,12 @@
#endif // _MSC_VER #endif // _MSC_VER
#if __has_cpp_attribute(nodiscard) >= 201603L
#define GSL_NODISCARD [[nodiscard]]
#else
#define GSL_NODISCARD
#endif
namespace gsl namespace gsl
{ {
// //
@ -67,13 +73,13 @@ private:
// finally() - convenience function to generate a final_action // finally() - convenience function to generate a final_action
template <class F> template <class F>
final_action<F> finally(const F& f) noexcept GSL_NODISCARD final_action<F> finally(const F& f) noexcept
{ {
return final_action<F>(f); return final_action<F>(f);
} }
template <class F> template <class F>
final_action<F> finally(F&& f) noexcept GSL_NODISCARD final_action<F> finally(F&& f) noexcept
{ {
return final_action<F>(std::forward<F>(f)); return final_action<F>(std::forward<F>(f));
} }