From b49c67fad2b9599088babf827dfe00523429be4d Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Tue, 2 Aug 2016 21:34:48 +0000 Subject: [PATCH] [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! git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277526 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/regex | 4 ++++ test/std/re/re.regex/types.pass.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/regex b/include/regex index 1139d8fb2..b223e63c8 100644 --- a/include/regex +++ b/include/regex @@ -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; diff --git a/test/std/re/re.regex/types.pass.cpp b/test/std/re/re.regex/types.pass.cpp index 5c0a5920d..2e48b4e84 100644 --- a/test/std/re/re.regex/types.pass.cpp +++ b/test/std/re/re.regex/types.pass.cpp @@ -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::value_type, char>::value), ""); + static_assert((std::is_same::traits_type, std::regex_traits >::value), ""); + static_assert((std::is_same::string_type, std::basic_string >::value), ""); static_assert((std::is_same::flag_type, std::regex_constants::syntax_option_type>::value), ""); static_assert((std::is_same::locale_type, std::locale>::value), ""); static_assert((std::is_same::value_type, wchar_t>::value), ""); + static_assert((std::is_same::traits_type, std::regex_traits >::value), ""); + static_assert((std::is_same::string_type, std::basic_string >::value), ""); static_assert((std::is_same::flag_type, std::regex_constants::syntax_option_type>::value), ""); static_assert((std::is_same::locale_type, std::locale>::value), "");