15a83710eSEric Fiselier //===----------------------------------------------------------------------===// 25a83710eSEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65a83710eSEric Fiselier // 75a83710eSEric Fiselier //===----------------------------------------------------------------------===// 85a83710eSEric Fiselier 95a83710eSEric Fiselier // <regex> 105a83710eSEric Fiselier 115a83710eSEric Fiselier // template <class BidirectionalIterator> class sub_match; 125a83710eSEric Fiselier 135a83710eSEric Fiselier // template <class charT, class ST, class BiIter> 145a83710eSEric Fiselier // basic_ostream<charT, ST>& 155a83710eSEric Fiselier // operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m); 165a83710eSEric Fiselier 175a83710eSEric Fiselier #include <regex> 185a83710eSEric Fiselier #include <sstream> 195a83710eSEric Fiselier #include <cassert> 20fd5ceb22SMarshall Clow #include "test_macros.h" 215a83710eSEric Fiselier 225a83710eSEric Fiselier template <class CharT> 235a83710eSEric Fiselier void test(const std::basic_string<CharT> & s)245a83710eSEric Fiseliertest(const std::basic_string<CharT>& s) 255a83710eSEric Fiselier { 265a83710eSEric Fiselier typedef std::basic_string<CharT> string; 275a83710eSEric Fiselier typedef std::sub_match<typename string::const_iterator> SM; 285a83710eSEric Fiselier typedef std::basic_ostringstream<CharT> ostringstream; 295a83710eSEric Fiselier SM sm; 305a83710eSEric Fiselier sm.first = s.begin(); 315a83710eSEric Fiselier sm.second = s.end(); 325a83710eSEric Fiselier sm.matched = true; 335a83710eSEric Fiselier ostringstream os; 345a83710eSEric Fiselier os << sm; 355a83710eSEric Fiselier assert(os.str() == s); 365a83710eSEric Fiselier } 375a83710eSEric Fiselier main(int,char **)382df59c50SJF Bastienint main(int, char**) 395a83710eSEric Fiselier { 405a83710eSEric Fiselier test(std::string("123")); 41*f4c1258dSLouis Dionne #ifndef TEST_HAS_NO_WIDE_CHARACTERS 425a83710eSEric Fiselier test(std::wstring(L"123")); 43*f4c1258dSLouis Dionne #endif 442df59c50SJF Bastien 452df59c50SJF Bastien return 0; 465a83710eSEric Fiselier } 47