GSL/include/gsl
beinhaerter ef0ffefe52
is_comparable_to_nullptr for better static_assert (#975)
* is_comparable_to_nullptr for better static_assert

Trying `gsl::not_null<char> p2{ 0 };` on VS2019 the current implementation would trigger

>error C2446 : '!=' : no conversion from 'nullptr' to 'int'
>message: A native nullptr can only be converted to bool or , using reinterpret_cast, to an integral type
>message: see reference to class template instantiation 'gsl::not_null<char>' being compiled
>error C2955 : 'std::is_convertible' : use of class template requires template argument list
>message: see declaration of 'std::is_convertible'
>error C2039 : 'value' : is not a member of 'std::is_convertible<_From,_To>'
>error C2065 : 'value' : undeclared identifier


The new implementation gives much shorter and clearer message and does exactly as the `static_assert` intends to do:

> error C2338: T cannot be compared to nullptr.
> message : see reference to class template instantiation 'gsl::not_null<char *>' being compiled

* Update include/gsl/pointers

Co-authored-by: Casey Carter <cartec69@gmail.com>

Co-authored-by: Werner Henze <w.henze@avm.de>
Co-authored-by: Casey Carter <cartec69@gmail.com>
2021-02-24 14:39:13 -08:00
..
algorithm renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
assert renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
byte renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
gsl remove multi_span (#958) 2020-12-09 15:18:07 -08:00
gsl_algorithm renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
gsl_assert renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
gsl_byte renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
gsl_narrow renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
gsl_util renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
narrow renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
pointers is_comparable_to_nullptr for better static_assert (#975) 2021-02-24 14:39:13 -08:00
span suppress bounds.1 (#950) 2020-11-11 13:47:58 -08:00
span_ext renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
string_span renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00
util renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946) 2020-10-29 17:38:48 -07:00