brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 1f01e95 Raw
49 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <regex>10 11// class match_results<BidirectionalIterator, Allocator>12 13// template <class BidirectionalIterator, class Allocator>14//    bool15//    operator==(const match_results<BidirectionalIterator, Allocator>& m1,16//               const match_results<BidirectionalIterator, Allocator>& m2);17 18// template <class BidirectionalIterator, class Allocator> // generated by the compiler in C++2019//    bool20//    operator!=(const match_results<BidirectionalIterator, Allocator>& m1,21//               const match_results<BidirectionalIterator, Allocator>& m2);22 23#include <regex>24#include <cassert>25#include "test_macros.h"26 27void28test()29{30    std::match_results<const char*> m1;31    const char s[] = "abcdefghijk";32    assert(std::regex_search(s, m1, std::regex("cd((e)fg)hi")));33    std::match_results<const char*> m2;34 35    assert(m1 == m1);36    assert(m1 != m2);37 38    m2 = m1;39 40    assert(m1 == m2);41}42 43int main(int, char**)44{45    test();46 47  return 0;48}49