[libcxx] r277526 - [libcxx] basic_regex: add traits_type, string_type
Hubert Tong via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 2 14:34:48 PDT 2016
Author: hubert.reinterpretcast
Date: Tue Aug 2 16:34:48 2016
New Revision: 277526
URL: http://llvm.org/viewvc/llvm-project?rev=277526&view=rev
Log:
[libcxx] basic_regex: add traits_type, string_type
Summary:
In the synopsis in C++11 subclause 28.8 [re.regex], `basic_regex` is
specified to have member typedefs `traits_type` and `string_type`. This
change adds them to libc++.
Reviewers: mclow.lists, rsmith, hubert.reinterpretcast
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D22698
Patch by Jason Liu!
Modified:
libcxx/trunk/include/regex
libcxx/trunk/test/std/re/re.regex/types.pass.cpp
Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=277526&r1=277525&r2=277526&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Tue Aug 2 16:34:48 2016
@@ -127,6 +127,8 @@ class basic_regex
public:
// types:
typedef charT value_type;
+ typedef traits traits_type;
+ typedef typename traits::string_type string_type;
typedef regex_constants::syntax_option_type flag_type;
typedef typename traits::locale_type locale_type;
@@ -2475,6 +2477,8 @@ class _LIBCPP_TYPE_VIS_ONLY basic_regex
public:
// types:
typedef _CharT value_type;
+ typedef _Traits traits_type;
+ typedef typename _Traits::string_type string_type;
typedef regex_constants::syntax_option_type flag_type;
typedef typename _Traits::locale_type locale_type;
Modified: libcxx/trunk/test/std/re/re.regex/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.regex/types.pass.cpp?rev=277526&r1=277525&r2=277526&view=diff
==============================================================================
--- libcxx/trunk/test/std/re/re.regex/types.pass.cpp (original)
+++ libcxx/trunk/test/std/re/re.regex/types.pass.cpp Tue Aug 2 16:34:48 2016
@@ -15,6 +15,8 @@
// public:
// // types:
// typedef charT value_type;
+// typedef traits traits_type;
+// typedef typename traits::string_type string_type;
// typedef regex_constants::syntax_option_type flag_type;
// typedef typename traits::locale_type locale_type;
@@ -25,11 +27,15 @@
int main()
{
static_assert((std::is_same<std::basic_regex<char>::value_type, char>::value), "");
+ static_assert((std::is_same<std::basic_regex<char>::traits_type, std::regex_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_regex<char>::string_type, std::basic_string<char> >::value), "");
static_assert((std::is_same<std::basic_regex<char>::flag_type,
std::regex_constants::syntax_option_type>::value), "");
static_assert((std::is_same<std::basic_regex<char>::locale_type, std::locale>::value), "");
static_assert((std::is_same<std::basic_regex<wchar_t>::value_type, wchar_t>::value), "");
+ static_assert((std::is_same<std::basic_regex<wchar_t>::traits_type, std::regex_traits<wchar_t> >::value), "");
+ static_assert((std::is_same<std::basic_regex<wchar_t>::string_type, std::basic_string<wchar_t> >::value), "");
static_assert((std::is_same<std::basic_regex<wchar_t>::flag_type,
std::regex_constants::syntax_option_type>::value), "");
static_assert((std::is_same<std::basic_regex<wchar_t>::locale_type, std::locale>::value), "");
More information about the cfe-commits
mailing list