| 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-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// <stack> |
| 10 |
|
| 11 |
// template <class T, class Container> |
| 12 |
// bool operator==(const stack<T, Container>& x,const stack<T, Container>& y); |
| 13 |
// |
| 14 |
// template <class T, class Container> |
| 15 |
// bool operator!=(const stack<T, Container>& x,const stack<T, Container>& y); |
| 16 |
|
| 17 |
#include <stack> |
| 18 |
#include <cassert> |
| 19 |
|
| 20 |
#include "test_macros.h" |
| 21 |
|
| 22 |
template <class C> |
| 23 |
C |
| 24 |
make(int n) |
| 25 |
{ |
| 26 |
C c; |
| 27 |
for (int i = 0; i < n; ++i) |
| 28 |
c.push(i); |
| 29 |
return c; |
| 30 |
} |
| 31 |
|
| 32 |
int main(int, char**) |
| 33 |
{ |
| 34 |
std::stack<int> q1 = make<std::stack<int> >(5); |
| 35 |
std::stack<int> q2 = make<std::stack<int> >(10); |
| 36 |
std::stack<int> q1_save = q1; |
| 37 |
std::stack<int> q2_save = q2; |
| 38 |
assert(q1 == q1_save); |
| 39 |
assert(q1 != q2); |
| 40 |
assert(q2 == q2_save); |
| 41 |
|
| 42 |
return 0; |
| 43 |
} |