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// <queue>10 11// priority_queue();12 13// void swap(priority_queue& q);14 15#include <queue>16#include <cassert>17 18#include "test_macros.h"19 20TEST_CONSTEXPR_CXX26 bool test() {21 std::priority_queue<int> q1;22 std::priority_queue<int> q2;23 q1.push(1);24 q1.push(3);25 q1.push(2);26 q1.swap(q2);27 assert(q1.empty());28 assert(q2.size() == 3);29 assert(q2.top() == 3);30 31 return true;32}33 34int main(int, char**) {35 assert(test());36#if TEST_STD_VER >= 2637 static_assert(test());38#endif39 40 return 0;41}42