43 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// class basic_syncbuf;17 18// allocator_type get_allocator() const noexcept;19 20#include <syncstream>21#include <cassert>22 23#include "test_macros.h"24#include "../helpers.h"25 26template <class T>27void test_get_allocator() {28 test_buf<T> base;29 test_allocator<T> alloc(42);30 const test_syncbuf<T, test_allocator<T>> buff(&base, alloc);31 assert(buff.get_allocator().id == 42);32 ASSERT_NOEXCEPT(buff.get_allocator());33}34 35int main(int, char**) {36 test_get_allocator<char>();37#ifndef TEST_HAS_NO_WIDE_CHARACTERS38 test_get_allocator<wchar_t>();39#endif40 41 return 0;42}43