"torchvision/vscode:/vscode.git/clone" did not exist on "1d0a3b11c6406e8b604c2c95b228bc6f7bc36ac4"
Commit 90796085 authored by jbeder's avatar jbeder
Browse files

Clarified some copy/assignment issues with the stream/streamcharsource.

parent 4ba713bf
#pragma once
#include "noncopyable.h"
#include <deque>
#include <ios>
#include <string>
......@@ -10,7 +11,7 @@ namespace YAML
{
static const size_t MAX_PARSER_PUSHBACK = 8;
class Stream
class Stream: private noncopyable
{
public:
friend class StreamCharSource;
......
#pragma once
#include "noncopyable.h"
#include <cstddef>
namespace YAML
......@@ -7,9 +8,10 @@ namespace YAML
class StreamCharSource
{
public:
StreamCharSource(const Stream& stream);
StreamCharSource(const Stream& stream): m_offset(0), m_stream(stream) {}
StreamCharSource(const StreamCharSource& source): m_offset(source.m_offset), m_stream(source.m_stream) {}
~StreamCharSource() {}
operator bool() const;
char operator [] (std::size_t i) const { return m_stream.CharAt(m_offset + i); }
bool operator !() const { return !static_cast<bool>(*this); }
......@@ -19,11 +21,10 @@ namespace YAML
private:
std::size_t m_offset;
const Stream& m_stream;
StreamCharSource& operator = (const StreamCharSource&); // non-assignable
};
inline StreamCharSource::StreamCharSource(const Stream& stream): m_offset(0), m_stream(stream) {
}
inline StreamCharSource::operator bool() const {
return m_stream.ReadAheadTo(m_offset);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment