brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · bcb2462 Raw
55 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// explicit match_results(const Allocator& a = Allocator()); // before C++2014// match_results() : match_results(Allocator()) {}           // C++2015// explicit match_results(const Allocator& a);               // C++2016 17#include <regex>18#include <cassert>19#include "test_macros.h"20#if TEST_STD_VER >= 1121#include "test_convertible.h"22 23template <typename T>24void test_implicit() {25  static_assert(test_convertible<T>(), "");26  static_assert(!test_convertible<T, typename T::allocator_type>(), "");27}28#endif29 30template <class CharT>31void32test()33{34    typedef std::match_results<const CharT*> M;35    typedef std::allocator<std::sub_match<const CharT*> > Alloc;36    M m;37    assert(m.size() == 0);38    assert(!m.ready());39    assert(m.get_allocator() == Alloc());40 41#if TEST_STD_VER >= 1142    test_implicit<M>();43#endif44}45 46int main(int, char**)47{48    test<char>();49#ifndef TEST_HAS_NO_WIDE_CHARACTERS50    test<wchar_t>();51#endif52 53  return 0;54}55