mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
adding deduction guide for strict_not_null
This commit is contained in:
parent
4610f26b33
commit
8e481ebe19
@ -119,13 +119,6 @@ private:
|
|||||||
T ptr_;
|
T ptr_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if (defined(__cplusplus) && (__cplusplus >= 201703L))
|
|
||||||
// deduction guide to prevent the ctad-maybe-unsupported warning
|
|
||||||
template <class T>
|
|
||||||
not_null(T ptr) -> not_null<T>;
|
|
||||||
|
|
||||||
#endif // (defined(__cplusplus) && (__cplusplus >= 201703L))
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
auto make_not_null(T&& t) {
|
auto make_not_null(T&& t) {
|
||||||
return not_null<std::remove_cv_t<std::remove_reference_t<T>>>{std::forward<T>(t)};
|
return not_null<std::remove_cv_t<std::remove_reference_t<T>>>{std::forward<T>(t)};
|
||||||
@ -279,6 +272,16 @@ auto make_strict_not_null(T&& t) {
|
|||||||
return strict_not_null<std::remove_cv_t<std::remove_reference_t<T>>>{std::forward<T>(t)};
|
return strict_not_null<std::remove_cv_t<std::remove_reference_t<T>>>{std::forward<T>(t)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (defined(__cplusplus) && (__cplusplus >= 201703L))
|
||||||
|
|
||||||
|
// deduction guides to prevent the ctad-maybe-unsupported warning
|
||||||
|
template <class T>
|
||||||
|
not_null(T ptr) -> not_null<T>;
|
||||||
|
template <class T>
|
||||||
|
strict_not_null(T ptr) -> strict_not_null<T>;
|
||||||
|
|
||||||
|
#endif // (defined(__cplusplus) && (__cplusplus >= 201703L))
|
||||||
|
|
||||||
} // namespace gsl
|
} // namespace gsl
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
|
Loading…
Reference in New Issue
Block a user