diff options
author | Anna Gringauze <annagrin@microsoft.com> | 2018-08-13 02:22:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-13 02:22:02 -0700 |
commit | 831584d94778e360d1616edc8b1562516795a853 (patch) | |
tree | 554b773979677c1cab8e777beef59566f82e3071 /include | |
parent | f1a2e91e4e08a24b1712ee4484ef534f502bead5 (diff) | |
download | platform_external_Microsoft-GSL-831584d94778e360d1616edc8b1562516795a853.tar.gz platform_external_Microsoft-GSL-831584d94778e360d1616edc8b1562516795a853.tar.bz2 platform_external_Microsoft-GSL-831584d94778e360d1616edc8b1562516795a853.zip |
Dev/annagrin/make not null (#711)
* Added c++17 test configurations for clang5.0 and clang6.0
* Added make_not_null helper to create a not_null
Introduction of explicit not_null constructor made it cumbersome to create not_nulls
in c++14. Adding make_not_null helper. Usage (see tests):
int i = 42;
auto x = make_not_null(&i);
helper(make_not_null(&i));
helper_const(make_not_null(&i));
* Added std::forward to make_not_null, fixed some code analysis warnings
* Fix build break in VS2015 Release configuration
* Fix build break in VS2015 Release configuration
Diffstat (limited to 'include')
-rw-r--r-- | include/gsl/pointers | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/gsl/pointers b/include/gsl/pointers index 69499d6..a338856 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -120,6 +120,11 @@ private: }; template <class T> +auto make_not_null(T&& t) { + return gsl::not_null<std::remove_cv_t<std::remove_reference_t<T>>>{std::forward<T>(t)}; +} + +template <class T> std::ostream& operator<<(std::ostream& os, const not_null<T>& val) { os << val.get(); |