constructor for _M_pattern.
* testsuite/tr1/7_regular_expressions/basic_regex/ctors/char/
string.cc: Test construction from different basic_string type.
* testsuite/tr1/7_regular_expressions/basic_regex/ctors/wchar_t/
string.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143275
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-01-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/tr1_impl/regex (basic_regex::basic_regex): Use range
+ constructor for _M_pattern.
+ * testsuite/tr1/7_regular_expressions/basic_regex/ctors/char/
+ string.cc: Test construction from different basic_string type.
+ * testsuite/tr1/7_regular_expressions/basic_regex/ctors/wchar_t/
+ string.cc: Likewise.
+
2009-01-07 Benjamin Kosnik <bkoz@redhat.com>
Jonathan Larmour <jifl@eCosCentric.com>
/**
* @brief Constructs a basic regular expression from the string
- * @p interpreted according to the flags in @p f.
+ * @p s interpreted according to the flags in @p f.
*
- * @param p A string containing a regular expression.
+ * @param s A string containing a regular expression.
* @param f Flags indicating the syntax rules and options.
*
- * @throws regex_error if @p p is not a valid regular expression.
+ * @throws regex_error if @p s is not a valid regular expression.
*/
template<typename _Ch_traits, typename _Ch_alloc>
explicit
basic_regex(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
flag_type __f = regex_constants::ECMAScript)
- : _M_flags(__f), _M_pattern(__s), _M_mark_count(0)
+ : _M_flags(__f), _M_pattern(__s.begin(), __s.end()), _M_mark_count(0)
{ _M_compile(); }
/**
#include <string>
#include <tr1/regex>
#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
// Tests C++ string constructor of the basic_regex class.
void test01()
test_type re(s);
}
+void test02()
+{
+ typedef std::tr1::basic_regex<char> test_type;
+ typedef __gnu_test::tracker_allocator<char> alloc_type;
+
+ std::basic_string<char, std::char_traits<char>, alloc_type> s("a*b");
+ test_type re(s);
+}
+
int
main()
{
test01();
+ test02();
return 0;
};
#include <string>
#include <tr1/regex>
#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
// Tests C++ string constructor of the basic_regex class.
void test01()
test_type re(s);
}
+void test02()
+{
+ typedef std::tr1::basic_regex<wchar_t> test_type;
+ typedef __gnu_test::tracker_allocator<wchar_t> alloc_type;
+
+ std::basic_string<wchar_t, std::char_traits<wchar_t>, alloc_type> s(L"a*b");
+ test_type re(s);
+}
+
int
main()
{
test01();
+ test02();
return 0;
};