Warning, /include/gsl/zstring is written in an unsupported language. File is not indexed.
0001 ///////////////////////////////////////////////////////////////////////////////
0002 //
0003 // Copyright (c) 2015 Microsoft Corporation. All rights reserved.
0004 //
0005 // This code is licensed under the MIT License (MIT).
0006 //
0007 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0008 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0009 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0010 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0011 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0012 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
0013 // THE SOFTWARE.
0014 //
0015 ///////////////////////////////////////////////////////////////////////////////
0016
0017 #ifndef GSL_ZSTRING_H
0018 #define GSL_ZSTRING_H
0019
0020 #include "./span_ext" // for dynamic_extent
0021
0022 #include <cstddef> // for size_t, nullptr_t
0023
0024 namespace gsl
0025 {
0026 //
0027 // czstring and wzstring
0028 //
0029 // These are "tag" typedefs for C-style strings (i.e. null-terminated character arrays)
0030 // that allow static analysis to help find bugs.
0031 //
0032 // There are no additional features/semantics that we can find a way to add inside the
0033 // type system for these types that will not either incur significant runtime costs or
0034 // (sometimes needlessly) break existing programs when introduced.
0035 //
0036
0037 template <typename CharT, std::size_t Extent = dynamic_extent>
0038 using basic_zstring = CharT*;
0039
0040 using czstring = basic_zstring<const char, dynamic_extent>;
0041
0042 using cwzstring = basic_zstring<const wchar_t, dynamic_extent>;
0043
0044 using cu16zstring = basic_zstring<const char16_t, dynamic_extent>;
0045
0046 using cu32zstring = basic_zstring<const char32_t, dynamic_extent>;
0047
0048 using zstring = basic_zstring<char, dynamic_extent>;
0049
0050 using wzstring = basic_zstring<wchar_t, dynamic_extent>;
0051
0052 using u16zstring = basic_zstring<char16_t, dynamic_extent>;
0053
0054 using u32zstring = basic_zstring<char32_t, dynamic_extent>;
0055
0056 } // namespace gsl
0057
0058 #endif // GSL_ZSTRING_H