[libcxx-commits] [libcxx] [libc++] Externally instantiate std::vformat_to (PR #71009)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 2 10:07:24 PDT 2023


================
@@ -397,19 +397,31 @@ requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt
 // https://reviews.llvm.org/D110499#inline-1180704
 // TODO FMT Evaluate whether we want to file a Clang bug report regarding this.
 template <output_iterator<const char&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+_LIBCPP_ALWAYS_INLINE _OutIt
----------------
ldionne wrote:

Would this work? Would it be future-proof in case we want to use `vformat_to` during constant evaluation in the future?

```
template <output_iterator<const char&> _OutIt>
_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
  return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args);
}

// Just redeclare without _LIBCPP_ALWAYS_INLINE and _LIBCPP_HIDE_FROM_ABI
template <>
_OutIt vformat_to<back_insert_iterator<string>>(back_insert_iterator<string>, string_view, format_args);

extern template _LIBCPP_EXPORTED_FROM_ABI back_insert_iterator<string> vformat_to<back_insert_iterator<string>>(back_insert_iterator<string>, string_view, format_args);
```

https://github.com/llvm/llvm-project/pull/71009


More information about the libcxx-commits mailing list