comparison OrthancServer/Database/Compatibility/SetOfResources.cpp @ 3712:2a170a8f1faf

replacing std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 15:32:45 +0100
parents 94f4a18a79cc
children
comparison
equal deleted inserted replaced
3709:1f4910999fe7 3712:2a170a8f1faf
53 resources_->insert(*it); 53 resources_->insert(*it);
54 } 54 }
55 } 55 }
56 else 56 else
57 { 57 {
58 std::auto_ptr<Resources> filtered(new Resources); 58 std::unique_ptr<Resources> filtered(new Resources);
59 59
60 for (std::list<int64_t>::const_iterator 60 for (std::list<int64_t>::const_iterator
61 it = resources.begin(); it != resources.end(); ++it) 61 it = resources.begin(); it != resources.end(); ++it)
62 { 62 {
63 if (resources_->find(*it) != resources_->end()) 63 if (resources_->find(*it) != resources_->end())
64 { 64 {
65 filtered->insert(*it); 65 filtered->insert(*it);
66 } 66 }
67 } 67 }
68 68
69 resources_ = filtered; 69 #if __cplusplus < 201103L
70 resources_.reset(filtered.release());
71 #else
72 resources_ = std::move(filtered);
73 #endif
70 } 74 }
71 } 75 }
72 76
73 77
74 void SetOfResources::GoDown() 78 void SetOfResources::GoDown()
78 throw OrthancException(ErrorCode_BadSequenceOfCalls); 82 throw OrthancException(ErrorCode_BadSequenceOfCalls);
79 } 83 }
80 84
81 if (resources_.get() != NULL) 85 if (resources_.get() != NULL)
82 { 86 {
83 std::auto_ptr<Resources> children(new Resources); 87 std::unique_ptr<Resources> children(new Resources);
84 88
85 for (Resources::const_iterator it = resources_->begin(); 89 for (Resources::const_iterator it = resources_->begin();
86 it != resources_->end(); ++it) 90 it != resources_->end(); ++it)
87 { 91 {
88 std::list<int64_t> tmp; 92 std::list<int64_t> tmp;
93 { 97 {
94 children->insert(*child); 98 children->insert(*child);
95 } 99 }
96 } 100 }
97 101
98 resources_ = children; 102 #if __cplusplus < 201103L
103 resources_.reset(children.release());
104 #else
105 resources_ = std::move(children);
106 #endif
99 } 107 }
100 108
101 switch (level_) 109 switch (level_)
102 { 110 {
103 case ResourceType_Patient: 111 case ResourceType_Patient: