42 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// UNSUPPORTED: c++03, c++11, c++1410 11// <functional>12 13// boyer_moore_horspool_searcher14 15// Make sure that the implicitly-generated CTAD works.16 17#include <functional>18 19#include "test_macros.h"20 21int main(int, char**) {22 {23 char const* str = "hello";24 std::boyer_moore_horspool_searcher searcher(str, str + 3);25 ASSERT_SAME_TYPE(decltype(searcher), std::boyer_moore_horspool_searcher<char const*, std::hash<char>, std::equal_to<>>);26 }27 {28 struct myhash : std::hash<char> { };29 char const* str = "hello";30 std::boyer_moore_horspool_searcher searcher(str, str + 3, myhash{}, std::not_equal_to<>());31 ASSERT_SAME_TYPE(decltype(searcher), std::boyer_moore_horspool_searcher<char const*, myhash, std::not_equal_to<>>);32 }33 {34 struct myhash : std::hash<char> { };35 char const* str = "hello";36 std::boyer_moore_horspool_searcher searcher(str, str + 3, myhash{});37 ASSERT_SAME_TYPE(decltype(searcher), std::boyer_moore_horspool_searcher<char const*, myhash, std::equal_to<>>);38 }39 40 return 0;41}42