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 // class match_results<BidirectionalIterator, Allocator> 13*4684ddb6SLionel Sambuc 14*4684ddb6SLionel Sambuc // bool ready() const; 15*4684ddb6SLionel Sambuc 16*4684ddb6SLionel Sambuc #include <regex> 17*4684ddb6SLionel Sambuc #include <cassert> 18*4684ddb6SLionel Sambuc 19*4684ddb6SLionel Sambuc void test1()20*4684ddb6SLionel Sambuctest1() 21*4684ddb6SLionel Sambuc { 22*4684ddb6SLionel Sambuc std::match_results<const char*> m; 23*4684ddb6SLionel Sambuc const char s[] = "abcdefghijk"; 24*4684ddb6SLionel Sambuc assert(m.ready() == false); 25*4684ddb6SLionel Sambuc std::regex_search(s, m, std::regex("cd((e)fg)hi")); 26*4684ddb6SLionel Sambuc assert(m.ready() == true); 27*4684ddb6SLionel Sambuc } 28*4684ddb6SLionel Sambuc 29*4684ddb6SLionel Sambuc void test2()30*4684ddb6SLionel Sambuctest2() 31*4684ddb6SLionel Sambuc { 32*4684ddb6SLionel Sambuc std::match_results<const char*> m; 33*4684ddb6SLionel Sambuc const char s[] = "abcdefghijk"; 34*4684ddb6SLionel Sambuc assert(m.ready() == false); 35*4684ddb6SLionel Sambuc std::regex_search(s, m, std::regex("z")); 36*4684ddb6SLionel Sambuc assert(m.ready() == true); 37*4684ddb6SLionel Sambuc } 38*4684ddb6SLionel Sambuc main()39*4684ddb6SLionel Sambucint main() 40*4684ddb6SLionel Sambuc { 41*4684ddb6SLionel Sambuc test1(); 42*4684ddb6SLionel Sambuc test2(); 43*4684ddb6SLionel Sambuc } 44