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

#include <memory>
#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;
      }
   };
}