mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-21 18:20:04 +00:00
Conform std::iterator_traits<fmt::appender>
to [iterator.traits]/1 (#4185)
* 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`.
* Remove unnecessary member types from basic_appender
This reverts commit 1accf6c0a0
.
* Address clang-format issue
This commit is contained in:
parent
18792893d8
commit
e62c41ffb0
@ -2382,11 +2382,6 @@ template <typename T> class basic_appender {
|
||||
detail::buffer<T>* container;
|
||||
|
||||
public:
|
||||
using iterator_category = int;
|
||||
using value_type = T;
|
||||
using pointer = T*;
|
||||
using reference = T&;
|
||||
using difference_type = decltype(pointer() - pointer());
|
||||
using container_type = detail::buffer<T>;
|
||||
|
||||
FMT_CONSTEXPR basic_appender(detail::buffer<T>& buf) : container(&buf) {}
|
||||
|
@ -119,11 +119,13 @@
|
||||
#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 =
|
||||
decltype(static_cast<int*>(nullptr) - static_cast<int*>(nullptr));
|
||||
using pointer = void;
|
||||
using reference = void;
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user