44 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++14, c++1710// UNSUPPORTED: no-localization11// UNSUPPORTED: libcpp-has-no-experimental-syncstream12 13// <syncstream>14 15// template<class charT, class traits, class Allocator>16// void swap(basic_syncbuf<charT, traits, Allocator>&,17// basic_syncbuf<charT, traits, Allocator>&);18 19#include <syncstream>20#include <cassert>21 22#include "test_macros.h"23 24template <class CharT>25void test() {26 std::basic_syncbuf<CharT> base1;27 std::basic_syncbuf<CharT> base2;28 std::basic_syncbuf<CharT> buff1(&base1);29 std::basic_syncbuf<CharT> buff2(&base2);30 std::swap(buff1, buff2);31 32 assert(buff1.get_wrapped() == &base2);33 assert(buff2.get_wrapped() == &base1);34}35 36int main(int, char**) {37 test<char>();38#ifndef TEST_HAS_NO_WIDE_CHARACTERS39 test<wchar_t>();40#endif41 42 return 0;43}44