43 lines · c
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-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___FORMAT_FMT_PAIR_LIKE_H11#define _LIBCPP___FORMAT_FMT_PAIR_LIKE_H12 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_header21#endif22 23_LIBCPP_BEGIN_NAMESPACE_STD24 25#if _LIBCPP_STD_VER >= 2326 27// [tuple.like] defines a tuple-like exposition only concept. This concept is not related to that. Therefore it uses a28// 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."34template <class _Tp>35concept __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 >= 2339 40_LIBCPP_END_NAMESPACE_STD41 42#endif // _LIBCPP___FORMAT_FMT_PAIR_LIKE_H43