xref: /llvm-project/libcxx/test/std/re/re.regex/types.pass.cpp (revision 2df59c50688c122bbcae7467d3eaf862c3ea3088)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <regex>
10 
11 // template <class charT, class traits = regex_traits<charT>>
12 // class basic_regex
13 // {
14 // public:
15 //     // types:
16 //     typedef charT                               value_type;
17 //     typedef traits                              traits_type;
18 //     typedef typename traits::string_type        string_type;
19 //     typedef regex_constants::syntax_option_type flag_type;
20 //     typedef typename traits::locale_type        locale_type;
21 
22 #include <regex>
23 #include <type_traits>
24 #include "test_macros.h"
25 
main(int,char **)26 int main(int, char**)
27 {
28     static_assert((std::is_same<std::basic_regex<char>::value_type, char>::value), "");
29     static_assert((std::is_same<std::basic_regex<char>::traits_type, std::regex_traits<char> >::value), "");
30     static_assert((std::is_same<std::basic_regex<char>::string_type, std::basic_string<char> >::value), "");
31     static_assert((std::is_same<std::basic_regex<char>::flag_type,
32                                 std::regex_constants::syntax_option_type>::value), "");
33     static_assert((std::is_same<std::basic_regex<char>::locale_type, std::locale>::value), "");
34 
35     static_assert((std::is_same<std::basic_regex<wchar_t>::value_type, wchar_t>::value), "");
36     static_assert((std::is_same<std::basic_regex<wchar_t>::traits_type, std::regex_traits<wchar_t> >::value), "");
37     static_assert((std::is_same<std::basic_regex<wchar_t>::string_type, std::basic_string<wchar_t> >::value), "");
38     static_assert((std::is_same<std::basic_regex<wchar_t>::flag_type,
39                                 std::regex_constants::syntax_option_type>::value), "");
40     static_assert((std::is_same<std::basic_regex<wchar_t>::locale_type, std::locale>::value), "");
41 
42   return 0;
43 }
44