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 //===----------------------------------------------------------------------===// 8 9 // <regex> 10 11 // class match_results<BidirectionalIterator, Allocator> 12 13 // size_type size() const; 14 // bool empty() const; 15 16 #include <regex> 17 #include <cassert> 18 #include "test_macros.h" 19 20 template <class CharT> 21 void test()22test() 23 { 24 std::match_results<const CharT*> m; 25 assert(m.empty()); 26 assert(m.size() == 0); 27 const char s[] = "abcdefghijk"; 28 assert(std::regex_search(s, m, std::regex("cd((e)fg)hi"))); 29 assert(!m.empty()); 30 assert(m.size() == 3); 31 } 32 main(int,char **)33int main(int, char**) 34 { 35 test<char>(); 36 37 return 0; 38 } 39