Merge branch 'master' into exception_fix_new_file

This commit is contained in:
Jordan Maples
2020-08-12 17:14:13 -07:00
3 changed files with 41 additions and 30 deletions
+8 -2
View File
@@ -32,6 +32,12 @@
#endif // _MSC_VER
#if defined(__cplusplus) && (__cplusplus >= 201703L)
#define GSL_NODISCARD [[nodiscard]]
#else
#define GSL_NODISCARD
#endif // defined(__cplusplus) && (__cplusplus >= 201703L)
namespace gsl
{
//
@@ -67,13 +73,13 @@ private:
// finally() - convenience function to generate a final_action
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);
}
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));
}
+1 -1
View File
@@ -63,7 +63,7 @@ template <class T>
class not_null
{
public:
static_assert(std::is_assignable<T&, std::nullptr_t>::value, "T cannot be assigned nullptr.");
static_assert(std::is_convertible<decltype(std::declval<T>() != nullptr), bool>::value, "T cannot be compared to nullptr.");
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
constexpr not_null(U&& u) : ptr_(std::forward<U>(u))