libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

types.pass.cpp (2023B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <regex>
     11 
     12 // template <class charT, class traits = regex_traits<charT>>
     13 // class basic_regex
     14 // {
     15 // public:
     16 //     // types:
     17 //     typedef charT                               value_type;
     18 //     typedef traits                              traits_type;
     19 //     typedef typename traits::string_type        string_type;
     20 //     typedef regex_constants::syntax_option_type flag_type;
     21 //     typedef typename traits::locale_type        locale_type;
     22 
     23 #include <regex>
     24 #include <type_traits>
     25 #include "test_macros.h"
     26 
     27 int main()
     28 {
     29     static_assert((std::is_same<std::basic_regex<char>::value_type, char>::value), "");
     30     static_assert((std::is_same<std::basic_regex<char>::traits_type, std::regex_traits<char> >::value), "");
     31     static_assert((std::is_same<std::basic_regex<char>::string_type, std::basic_string<char> >::value), "");
     32     static_assert((std::is_same<std::basic_regex<char>::flag_type,
     33                                 std::regex_constants::syntax_option_type>::value), "");
     34     static_assert((std::is_same<std::basic_regex<char>::locale_type, std::locale>::value), "");
     35 
     36     static_assert((std::is_same<std::basic_regex<wchar_t>::value_type, wchar_t>::value), "");
     37     static_assert((std::is_same<std::basic_regex<wchar_t>::traits_type, std::regex_traits<wchar_t> >::value), "");
     38     static_assert((std::is_same<std::basic_regex<wchar_t>::string_type, std::basic_string<wchar_t> >::value), "");
     39     static_assert((std::is_same<std::basic_regex<wchar_t>::flag_type,
     40                                 std::regex_constants::syntax_option_type>::value), "");
     41     static_assert((std::is_same<std::basic_regex<wchar_t>::locale_type, std::locale>::value), "");
     42 }