[libc++][NFC] Move format_to_n_result.
Places `format_to_n_result` to its own file. While working on D112361 it turns out the type will be used outside the format header. Reviewed By: #libc, Quuxplusone, Mordante Differential Revision: https://reviews.llvm.org/D113831
This commit is contained in:
@@ -144,6 +144,7 @@ set(files
|
||||
__format/format_fwd.h
|
||||
__format/format_parse_context.h
|
||||
__format/format_string.h
|
||||
__format/format_to_n_result.h
|
||||
__format/formatter.h
|
||||
__format/formatter_bool.h
|
||||
__format/formatter_char.h
|
||||
|
||||
41
libcxx/include/__format/format_to_n_result.h
Normal file
41
libcxx/include/__format/format_to_n_result.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// -*- 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___FORMAT_FORMAT_TO_N_RESULT_H
|
||||
#define _LIBCPP___FORMAT_FORMAT_TO_N_RESULT_H
|
||||
|
||||
#include <__config>
|
||||
#include <__iterator/incrementable_traits.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
// TODO FMT Remove this once we require compilers with proper C++20 support.
|
||||
// If the compiler has no concepts support, the format header will be disabled.
|
||||
// Without concepts support enable_if needs to be used and that too much effort
|
||||
// to support compilers with partial C++20 support.
|
||||
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
|
||||
|
||||
template <class _OutIt>
|
||||
struct _LIBCPP_TEMPLATE_VIS format_to_n_result {
|
||||
_OutIt out;
|
||||
iter_difference_t<_OutIt> size;
|
||||
};
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
|
||||
#endif //_LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___FORMAT_FORMAT_TO_N_RESULT_H
|
||||
@@ -278,6 +278,7 @@ namespace std {
|
||||
#include <__format/format_fwd.h>
|
||||
#include <__format/format_parse_context.h>
|
||||
#include <__format/format_string.h>
|
||||
#include <__format/format_to_n_result.h>
|
||||
#include <__format/formatter.h>
|
||||
#include <__format/formatter_bool.h>
|
||||
#include <__format/formatter_char.h>
|
||||
@@ -579,12 +580,6 @@ format(wstring_view __fmt, const _Args&... __args) {
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _OutIt>
|
||||
struct _LIBCPP_TEMPLATE_VIS format_to_n_result {
|
||||
_OutIt out;
|
||||
iter_difference_t<_OutIt> size;
|
||||
};
|
||||
|
||||
template <output_iterator<const char&> _OutIt, class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt>
|
||||
format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, string_view __fmt,
|
||||
|
||||
@@ -463,6 +463,7 @@ module std [system] {
|
||||
module format_fwd { private header "__format/format_fwd.h" }
|
||||
module format_parse_context { private header "__format/format_parse_context.h" }
|
||||
module format_string { private header "__format/format_string.h" }
|
||||
module format_to_n_result { private header "__format/format_to_n_result.h" }
|
||||
module formatter { private header "__format/formatter.h" }
|
||||
module formatter_bool { private header "__format/formatter_bool.h" }
|
||||
module formatter_char { private header "__format/formatter_char.h" }
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// REQUIRES: modules-build
|
||||
|
||||
// WARNING: This test was generated by 'generate_private_header_tests.py'
|
||||
// and should not be edited manually.
|
||||
|
||||
// expected-error@*:* {{use of private header from outside its module: '__format/format_to_n_result.h'}}
|
||||
#include <__format/format_to_n_result.h>
|
||||
Reference in New Issue
Block a user