47 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// match_results(const match_results& m);14 15#include <regex>16#include <cassert>17#include "test_macros.h"18#include "test_allocator.h"19 20template <class CharT, class Allocator>21void22test(const Allocator& a)23{24 typedef std::match_results<const CharT*, Allocator> SM;25 SM m0(a);26 SM m1(m0);27 28 assert(m1.size() == m0.size());29 assert(m1.ready() == m0.ready());30 assert(m1.get_allocator() == m0.get_allocator());31}32 33int main(int, char**)34{35 test<char> (std::allocator<std::sub_match<const char *> >());36#ifndef TEST_HAS_NO_WIDE_CHARACTERS37 test<wchar_t>(std::allocator<std::sub_match<const wchar_t *> >());38#endif39 40 test<char> (test_allocator<std::sub_match<const char*> >(3));41#ifndef TEST_HAS_NO_WIDE_CHARACTERS42 test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3));43#endif44 45 return 0;46}47