Conform std::iterator_traits<fmt::appender> to [iterator.traits]/1

> In addition, the types
> ```c++
> iterator_traits<I>::pointer
> iterator_traits<I>::reference
> ```
> shall be defined as the iterator’s pointer and reference types; that is, for an iterator object `a` of class type, the same type as `decltype(a.operator->())` and `decltype(*a)`, respectively. The type `iterator_traits<I>::pointer` shall be void for an iterator of class type `I` that does not support `operator->`. Additionally, in the case of an output iterator, the types
> ```c++
> iterator_traits<I>::value_type
> iterator_traits<I>::difference_type
> iterator_traits<I>::reference
> ```
> may be defined as `void`.
This commit is contained in:
Casey Carter
2024-10-02 07:24:14 -07:00
parent c90bc91862
commit 77a7bd621f

View File

@@ -119,11 +119,12 @@
#endif
namespace std {
template <> struct iterator_traits<fmt::appender> {
template <class T> struct iterator_traits<fmt::basic_appender<T>> {
using iterator_category = output_iterator_tag;
using value_type = char;
using reference = char&;
using difference_type = fmt::appender::difference_type;
using value_type = T;
using difference_type = void;
using pointer = void;
using reference = void;
};
} // namespace std