aboutsummaryrefslogtreecommitdiff
path: root/include/openvic-dataloader/detail/OStreamOutputIterator.hpp
blob: 81f6c896d4f5961a090f2c25cb1b9ebe89ee0ecb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include <ostream>

namespace ovdl::detail {
   struct OStreamOutputIterator {
      std::reference_wrapper<std::ostream> _stream;

      auto operator*() const noexcept {
         return *this;
      }
      auto operator++(int) const noexcept {
         return *this;
      }

      OStreamOutputIterator& operator=(char c) {
         _stream.get().put(c);
         return *this;
      }
   };
}