[flang][OpenMP] Use range-for to iterate over SymbolSourceMap, NFC
[llvm-project.git] / libcxx / test / std / re / re.submatch / re.submatch.op / stream.pass.cpp
blob244d78d120f3544acbe80ef26f5f0f50f8ff2a30
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <regex>
11 // template <class BidirectionalIterator> class sub_match;
13 // template <class charT, class ST, class BiIter>
14 // basic_ostream<charT, ST>&
15 // operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m);
17 #include <regex>
18 #include <sstream>
19 #include <cassert>
20 #include "test_macros.h"
22 template <class CharT>
23 void
24 test(const std::basic_string<CharT>& s)
26 typedef std::basic_string<CharT> string;
27 typedef std::sub_match<typename string::const_iterator> SM;
28 typedef std::basic_ostringstream<CharT> ostringstream;
29 SM sm;
30 sm.first = s.begin();
31 sm.second = s.end();
32 sm.matched = true;
33 ostringstream os;
34 os << sm;
35 assert(os.str() == s);
38 int main(int, char**)
40 test(std::string("123"));
41 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
42 test(std::wstring(L"123"));
43 #endif
45 return 0;