xref: /llvm-project/libcxx/include/__vector/vector_bool_formatter.h (revision 2e43a304f10fd801f068d0f9831f01f2c5b0b2e2)
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef _LIBCPP___VECTOR_VECTOR_BOOL_FORMATTER_H
10 #define _LIBCPP___VECTOR_VECTOR_BOOL_FORMATTER_H
11 
12 #include <__concepts/same_as.h>
13 #include <__config>
14 #include <__format/formatter.h>
15 #include <__format/formatter_bool.h>
16 #include <__fwd/vector.h>
17 
18 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19 #  pragma GCC system_header
20 #endif
21 
22 #if _LIBCPP_STD_VER >= 23
23 
24 _LIBCPP_BEGIN_NAMESPACE_STD
25 
26 template <class _Tp, class _CharT>
27 // Since is-vector-bool-reference is only used once it's inlined here.
28   requires same_as<typename _Tp::__container, vector<bool, typename _Tp::__container::allocator_type>>
29 struct _LIBCPP_TEMPLATE_VIS formatter<_Tp, _CharT> {
30 private:
31   formatter<bool, _CharT> __underlying_;
32 
33 public:
34   template <class _ParseContext>
35   _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
36     return __underlying_.parse(__ctx);
37   }
38 
39   template <class _FormatContext>
40   _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _Tp& __ref, _FormatContext& __ctx) const {
41     return __underlying_.format(__ref, __ctx);
42   }
43 };
44 
45 _LIBCPP_END_NAMESPACE_STD
46 
47 #endif // _LIBCPP_STD_VER >= 23
48 
49 #endif // _LIBCPP___VECTOR_VECTOR_BOOL_FORMATTER_H
50