1*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===// 2*4684ddb6SLionel Sambuc // 3*4684ddb6SLionel Sambuc // The LLVM Compiler Infrastructure 4*4684ddb6SLionel Sambuc // 5*4684ddb6SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open 6*4684ddb6SLionel Sambuc // Source Licenses. See LICENSE.TXT for details. 7*4684ddb6SLionel Sambuc // 8*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===// 9*4684ddb6SLionel Sambuc 10*4684ddb6SLionel Sambuc // <regex> 11*4684ddb6SLionel Sambuc 12*4684ddb6SLionel Sambuc // template <class BidirectionalIterator> class sub_match; 13*4684ddb6SLionel Sambuc 14*4684ddb6SLionel Sambuc // template <class charT, class ST, class BiIter> 15*4684ddb6SLionel Sambuc // basic_ostream<charT, ST>& 16*4684ddb6SLionel Sambuc // operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m); 17*4684ddb6SLionel Sambuc 18*4684ddb6SLionel Sambuc #include <regex> 19*4684ddb6SLionel Sambuc #include <sstream> 20*4684ddb6SLionel Sambuc #include <cassert> 21*4684ddb6SLionel Sambuc 22*4684ddb6SLionel Sambuc template <class CharT> 23*4684ddb6SLionel Sambuc void test(const std::basic_string<CharT> & s)24*4684ddb6SLionel Sambuctest(const std::basic_string<CharT>& s) 25*4684ddb6SLionel Sambuc { 26*4684ddb6SLionel Sambuc typedef std::basic_string<CharT> string; 27*4684ddb6SLionel Sambuc typedef std::sub_match<typename string::const_iterator> SM; 28*4684ddb6SLionel Sambuc typedef std::basic_ostringstream<CharT> ostringstream; 29*4684ddb6SLionel Sambuc SM sm; 30*4684ddb6SLionel Sambuc sm.first = s.begin(); 31*4684ddb6SLionel Sambuc sm.second = s.end(); 32*4684ddb6SLionel Sambuc sm.matched = true; 33*4684ddb6SLionel Sambuc ostringstream os; 34*4684ddb6SLionel Sambuc os << sm; 35*4684ddb6SLionel Sambuc assert(os.str() == s); 36*4684ddb6SLionel Sambuc } 37*4684ddb6SLionel Sambuc main()38*4684ddb6SLionel Sambucint main() 39*4684ddb6SLionel Sambuc { 40*4684ddb6SLionel Sambuc test(std::string("123")); 41*4684ddb6SLionel Sambuc test(std::wstring(L"123")); 42*4684ddb6SLionel Sambuc } 43