MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / counting_iterator

Class counting_iterator

extlibs/fmt/include/fmt/format.h:366–397  ·  view source on GitHub ↗

An output iterator that counts the number of objects written to it and discards them.

Source from the content-addressed store, hash-verified

364// An output iterator that counts the number of objects written to it and
365// discards them.
366class counting_iterator {
367 private:
368 std::size_t count_;
369
370 public:
371 using iterator_category = std::output_iterator_tag;
372 using difference_type = std::ptrdiff_t;
373 using pointer = void;
374 using reference = void;
375 using _Unchecked_type = counting_iterator; // Mark iterator as checked.
376
377 struct value_type {
378 template <typename T> void operator=(const T&) {}
379 };
380
381 counting_iterator() : count_(0) {}
382
383 std::size_t count() const { return count_; }
384
385 counting_iterator& operator++() {
386 ++count_;
387 return *this;
388 }
389
390 counting_iterator operator++(int) {
391 auto it = *this;
392 ++*this;
393 return it;
394 }
395
396 value_type operator*() const { return {}; }
397};
398
399template <typename OutputIt> class truncating_iterator_base {
400 protected:

Callers 3

float_writerMethod · 0.85
formatted_sizeFunction · 0.85
formatted_sizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected