|
| 1 | +// -*- C++ -*- |
| 2 | +//===----------------------------------------------------------------------===// |
| 3 | +// |
| 4 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | +// See https://llvm.org/LICENSE.txt for license information. |
| 6 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | +// |
| 8 | +//===----------------------------------------------------------------------===// |
| 9 | + |
| 10 | +#ifndef _LIBCPP___FORMAT_FMT_PAIR_LIKE_H |
| 11 | +#define _LIBCPP___FORMAT_FMT_PAIR_LIKE_H |
| 12 | + |
| 13 | +#include <__config> |
| 14 | +#include <__fwd/pair.h> |
| 15 | +#include <__fwd/tuple.h> |
| 16 | +#include <__tuple/tuple_size.h> |
| 17 | +#include <__type_traits/is_specialization.h> |
| 18 | + |
| 19 | +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 20 | +# pragma GCC system_header |
| 21 | +#endif |
| 22 | + |
| 23 | +_LIBCPP_BEGIN_NAMESPACE_STD |
| 24 | + |
| 25 | +#if _LIBCPP_STD_VER >= 23 |
| 26 | + |
| 27 | +// [tuple.like] defines a tuple-like exposition only concept. This concept is not related to that. Therefore it uses a |
| 28 | +// different name for the concept. |
| 29 | +// |
| 30 | +// TODO FMT Add a test to validate we fail when using that concept after P2165 has been implemented. |
| 31 | + |
| 32 | +// [format.range.fmtkind]/2.2.1 and [tab:formatter.range.type]: |
| 33 | +// "U is either a specialization of pair or a specialization of tuple such that tuple_size_v<U> is 2." |
| 34 | +template <class _Tp> |
| 35 | +concept __fmt_pair_like = |
| 36 | + __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2); |
| 37 | + |
| 38 | +#endif // _LIBCPP_STD_VER >= 23 |
| 39 | + |
| 40 | +_LIBCPP_END_NAMESPACE_STD |
| 41 | + |
| 42 | +#endif // _LIBCPP___FORMAT_FMT_PAIR_LIKE_H |
0 commit comments