llvm-project/libcxx/test/support/test_basic_format_arg.h
Petr Hosek 02f95b7751 Revert "[libc++][format] P2637R3: Member visit (std::basic_format_arg) (#76449)"
This reverts commit 7d9b5aa65b09126031e1c2903605a7d34aea4bc1 since
std/utilities/format/format.arguments/format.arg/visit.return_type.pass.cpp
is failing on Windows when building with Clang-cl.
2024-01-22 17:23:05 +00:00

25 lines
830 B
C++

//===----------------------------------------------------------------------===//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <concepts>
#include <format>
#include "test_macros.h"
/// Returns whether the basic_format_arg contains a type T with the expected value.
template <class Context, class T>
bool test_basic_format_arg(std::basic_format_arg<Context> arg, T expected) {
return std::visit_format_arg(
[expected](auto a) {
if constexpr (std::same_as<decltype(a), T>)
return a == expected;
else
return false;
},
arg);
}