blob: 4874c0d0592182b3528dc7c78dbe816fe627b1ce [file] [log] [blame]
Howard Hinnantcd85b9e2010-06-29 18:37:43 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantcd85b9e2010-06-29 18:37:43 +00007//
8//===----------------------------------------------------------------------===//
9
10// <regex>
11
12// template <class BidirectionalIterator> class sub_match;
13
14// difference_type length() const;
15
16#include <regex>
17#include <cassert>
Howard Hinnantcd85b9e2010-06-29 18:37:43 +000018
19int main()
20{
21 {
22 typedef char CharT;
23 typedef std::sub_match<const CharT*> SM;
24 SM sm = SM();
25 assert(sm.length() == 0);
26 const CharT s[] = {'1', '2', '3', 0};
27 sm.first = s;
28 sm.second = s + 3;
29 sm.matched = true;
30 assert(sm.length() == 3);
31 }
32 {
33 typedef wchar_t CharT;
34 typedef std::sub_match<const CharT*> SM;
35 SM sm = SM();
36 assert(sm.length() == 0);
37 const CharT s[] = {'1', '2', '3', 0};
38 sm.first = s;
39 sm.second = s + 3;
40 sm.matched = true;
41 assert(sm.length() == 3);
42 }
43}