1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <regex> 11 12// template <class BidirectionalIterator> class sub_match; 13 14// int compare(const sub_match& s) const; 15 16#include <regex> 17#include <cassert> 18 19int main() 20{ 21 { 22 typedef char CharT; 23 typedef std::sub_match<const CharT*> SM; 24 SM sm = SM(); 25 SM sm2 = SM(); 26 assert(sm.compare(sm2) == 0); 27 const CharT s[] = {'1', '2', '3', 0}; 28 sm.first = s; 29 sm.second = s + 3; 30 sm.matched = true; 31 assert(sm.compare(sm2) > 0); 32 sm2.first = s; 33 sm2.second = s + 3; 34 sm2.matched = true; 35 assert(sm.compare(sm2) == 0); 36 } 37 { 38 typedef wchar_t CharT; 39 typedef std::sub_match<const CharT*> SM; 40 SM sm = SM(); 41 SM sm2 = SM(); 42 assert(sm.compare(sm2) == 0); 43 const CharT s[] = {'1', '2', '3', 0}; 44 sm.first = s; 45 sm.second = s + 3; 46 sm.matched = true; 47 assert(sm.compare(sm2) > 0); 48 sm2.first = s; 49 sm2.second = s + 3; 50 sm2.matched = true; 51 assert(sm.compare(sm2) == 0); 52 } 53} 54