This commit is contained in:
@@ -3,23 +3,29 @@
|
||||
// Lifted from Jerry Coffin's 's prefix_ostream_iterator
|
||||
#pragma once
|
||||
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <sp/protocol/Field.h>
|
||||
|
||||
namespace sp {
|
||||
|
||||
template <class T, class charT = char, class traits = std::char_traits<charT>>
|
||||
class OstreamFieldIterator : public std::iterator<std::output_iterator_tag, void, void, void, void> {
|
||||
class OstreamFieldIterator {
|
||||
private:
|
||||
std::basic_ostream<charT, traits>* m_Os;
|
||||
std::string m_Delimiter;
|
||||
bool m_FirstElem;
|
||||
|
||||
public:
|
||||
typedef charT char_type;
|
||||
typedef traits traits_type;
|
||||
typedef std::basic_ostream<charT, traits> ostream_type;
|
||||
using iterator_category = std::output_iterator_tag;
|
||||
using value_type = void;
|
||||
using difference_type = void;
|
||||
using pointer = void;
|
||||
using reference = void;
|
||||
|
||||
using char_type = charT;
|
||||
using traits_type = traits;
|
||||
using ostream_type = std::basic_ostream<charT, traits>;
|
||||
|
||||
OstreamFieldIterator(ostream_type& a_Stream) : m_Os(&a_Stream), m_Delimiter(0), m_FirstElem(true) {}
|
||||
OstreamFieldIterator(ostream_type& a_Stream, std::string&& a_Delimiter) :
|
||||
m_Os(&a_Stream), m_Delimiter(std::move(a_Delimiter)), m_FirstElem(true) {}
|
||||
|
||||
Reference in New Issue
Block a user