diff --git a/include/yaml-cpp/emitter.h b/include/yaml-cpp/emitter.h index cc49659..5bffc25 100644 --- a/include/yaml-cpp/emitter.h +++ b/include/yaml-cpp/emitter.h @@ -122,7 +122,7 @@ class YAML_CPP_API Emitter : private noncopyable { bool CanEmitNewline() const; private: - std::auto_ptr m_pState; + std::unique_ptr m_pState; ostream_wrapper m_stream; }; diff --git a/include/yaml-cpp/parser.h b/include/yaml-cpp/parser.h index 24880e4..edbfd8f 100644 --- a/include/yaml-cpp/parser.h +++ b/include/yaml-cpp/parser.h @@ -40,8 +40,8 @@ class YAML_CPP_API Parser : private noncopyable { void HandleTagDirective(const Token& token); private: - std::auto_ptr m_pScanner; - std::auto_ptr m_pDirectives; + std::unique_ptr m_pScanner; + std::unique_ptr m_pDirectives; }; } diff --git a/src/emitterstate.cpp b/src/emitterstate.cpp index a0874ac..469040f 100644 --- a/src/emitterstate.cpp +++ b/src/emitterstate.cpp @@ -124,7 +124,7 @@ void EmitterState::StartedGroup(GroupType::value type) { const int lastGroupIndent = (m_groups.empty() ? 0 : m_groups.top().indent); m_curIndent += lastGroupIndent; - std::auto_ptr pGroup(new Group(type)); + std::unique_ptr pGroup(new Group(type)); // transfer settings (which last until this group is done) pGroup->modifiedSettings = m_modifiedSettings; @@ -149,7 +149,7 @@ void EmitterState::EndedGroup(GroupType::value type) { // get rid of the current group { - std::auto_ptr pFinishedGroup = m_groups.pop(); + std::unique_ptr pFinishedGroup = m_groups.pop(); if (pFinishedGroup->type != type) return SetError(ErrorMsg::UNMATCHED_GROUP_TAG); } diff --git a/src/ptr_stack.h b/src/ptr_stack.h index f378ffc..3757432 100644 --- a/src/ptr_stack.h +++ b/src/ptr_stack.h @@ -29,12 +29,12 @@ class ptr_stack : private YAML::noncopyable { std::size_t size() const { return m_data.size(); } bool empty() const { return m_data.empty(); } - void push(std::auto_ptr t) { + void push(std::unique_ptr &t) { m_data.push_back(NULL); m_data.back() = t.release(); } - std::auto_ptr pop() { - std::auto_ptr t(m_data.back()); + std::unique_ptr pop() { + std::unique_ptr t(m_data.back()); m_data.pop_back(); return t; } diff --git a/src/ptr_vector.h b/src/ptr_vector.h index a546a89..de4f8c4 100644 --- a/src/ptr_vector.h +++ b/src/ptr_vector.h @@ -31,7 +31,7 @@ class ptr_vector : private YAML::noncopyable { std::size_t size() const { return m_data.size(); } bool empty() const { return m_data.empty(); } - void push_back(std::auto_ptr t) { + void push_back(std::unique_ptr &t) { m_data.push_back(NULL); m_data.back() = t.release(); } diff --git a/src/scanner.cpp b/src/scanner.cpp index 680c73b..f89ed9b 100644 --- a/src/scanner.cpp +++ b/src/scanner.cpp @@ -233,7 +233,7 @@ const RegEx& Scanner::GetValueRegex() const { void Scanner::StartStream() { m_startedStream = true; m_simpleKeyAllowed = true; - std::auto_ptr pIndent(new IndentMarker(-1, IndentMarker::NONE)); + std::unique_ptr pIndent(new IndentMarker(-1, IndentMarker::NONE)); m_indentRefs.push_back(pIndent); m_indents.push(&m_indentRefs.back()); } @@ -281,7 +281,7 @@ Scanner::IndentMarker* Scanner::PushIndentTo(int column, if (InFlowContext()) return 0; - std::auto_ptr pIndent(new IndentMarker(column, type)); + std::unique_ptr pIndent(new IndentMarker(column, type)); IndentMarker& indent = *pIndent; const IndentMarker& lastIndent = *m_indents.top(); diff --git a/src/setting.h b/src/setting.h index 3ff8c20..508193e 100644 --- a/src/setting.h +++ b/src/setting.h @@ -20,7 +20,7 @@ class Setting { Setting() : m_value() {} const T get() const { return m_value; } - std::auto_ptr set(const T& value); + std::unique_ptr set(const T& value); void restore(const Setting& oldSetting) { m_value = oldSetting.get(); } private: @@ -49,8 +49,8 @@ class SettingChange : public SettingChangeBase { }; template -inline std::auto_ptr Setting::set(const T& value) { - std::auto_ptr pChange(new SettingChange(this)); +inline std::unique_ptr Setting::set(const T& value) { + std::unique_ptr pChange(new SettingChange(this)); m_value = value; return pChange; } @@ -75,11 +75,11 @@ class SettingChanges : private noncopyable { (*it)->pop(); } - void push(std::auto_ptr pSettingChange) { + void push(std::unique_ptr pSettingChange) { m_settingChanges.push_back(pSettingChange.release()); } - // like std::auto_ptr - assignment is transfer of ownership + // like std::unique_ptr - assignment is transfer of ownership SettingChanges& operator=(SettingChanges& rhs) { if (this == &rhs) return *this; diff --git a/src/singledocparser.h b/src/singledocparser.h index ed0aad5..2b92067 100644 --- a/src/singledocparser.h +++ b/src/singledocparser.h @@ -53,7 +53,7 @@ class SingleDocParser : private noncopyable { private: Scanner& m_scanner; const Directives& m_directives; - std::auto_ptr m_pCollectionStack; + std::unique_ptr m_pCollectionStack; typedef std::map Anchors; Anchors m_anchors;