15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier
95a83710eSEric Fiselier // <valarray>
105a83710eSEric Fiselier
115a83710eSEric Fiselier // template<class T> class valarray;
125a83710eSEric Fiselier
135a83710eSEric Fiselier // template<class T>
145a83710eSEric Fiselier // valarray<bool>
155a83710eSEric Fiselier // operator==(const valarray<T>& x, const T& y);
165a83710eSEric Fiselier
175a83710eSEric Fiselier #include <valarray>
185a83710eSEric Fiselier #include <cassert>
19e898b484SStephan T. Lavavej #include <cstddef>
205a83710eSEric Fiselier
217fc6a556SMarshall Clow #include "test_macros.h"
227fc6a556SMarshall Clow
main(int,char **)232df59c50SJF Bastien int main(int, char**)
245a83710eSEric Fiselier {
255a83710eSEric Fiselier {
265a83710eSEric Fiselier typedef int T;
275a83710eSEric Fiselier T a1[] = {1, 2, 3, 4, 0};
285a83710eSEric Fiselier bool a3[] = {false, true, false, false, false};
29*469d18c0SArthur O'Dwyer const unsigned N = 5;
305a83710eSEric Fiselier std::valarray<T> v1(a1, N);
315a83710eSEric Fiselier std::valarray<bool> v3 = v1 == 2;
32*469d18c0SArthur O'Dwyer std::valarray<bool> v3a = +(v1 == 2);
33*469d18c0SArthur O'Dwyer assert(v3.size() == N);
34*469d18c0SArthur O'Dwyer assert(v3a.size() == N);
35*469d18c0SArthur O'Dwyer for (std::size_t i = 0; i < N; ++i) {
365a83710eSEric Fiselier assert(v3[i] == a3[i]);
37*469d18c0SArthur O'Dwyer assert(v3a[i] == a3[i]);
38*469d18c0SArthur O'Dwyer }
395a83710eSEric Fiselier }
402df59c50SJF Bastien
412df59c50SJF Bastien return 0;
425a83710eSEric Fiselier }
43