Skip to content

Commit 36fc8fa

Browse files
authored
Merge pull request cms-sw#43337 from makortel/assignmentView
Remove explicit assignment operator from edm::View
2 parents 2fd5c19 + 796f732 commit 36fc8fa

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

DataFormats/Common/interface/View.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ namespace edm {
4646
std::unique_ptr<ViewBase> clone() const;
4747

4848
protected:
49-
ViewBase();
50-
ViewBase(ViewBase const&);
51-
ViewBase& operator=(ViewBase const&);
49+
ViewBase() = default;
50+
ViewBase(ViewBase const&) = default;
51+
ViewBase(ViewBase&&) = default;
52+
ViewBase& operator=(ViewBase const&) = default;
53+
ViewBase& operator=(ViewBase&&) = default;
5254
virtual std::unique_ptr<ViewBase> doClone() const = 0;
5355
void swap(ViewBase&) {} // Nothing to swap
5456
};
@@ -101,12 +103,8 @@ namespace edm {
101103
// infrastructure code.
102104
View(std::vector<void const*> const& pointers, FillViewHelperVector const& helpers, EDProductGetter const* getter);
103105

104-
~View() override;
105-
106106
void swap(View& other);
107107

108-
View& operator=(View const& rhs);
109-
110108
size_type capacity() const;
111109

112110
// Most non-const member functions not present.
@@ -191,9 +189,6 @@ namespace edm {
191189
}
192190
}
193191

194-
template <typename T>
195-
View<T>::~View() {}
196-
197192
template <typename T>
198193
inline void View<T>::swap(View& other) {
199194
this->ViewBase::swap(other);
@@ -294,13 +289,6 @@ namespace edm {
294289
return std::unique_ptr<ViewBase>{new View(*this)};
295290
}
296291

297-
template <typename T>
298-
inline View<T>& View<T>::operator=(View<T> const& rhs) {
299-
View<T> temp(rhs);
300-
this->swap(temp);
301-
return *this;
302-
}
303-
304292
template <typename T>
305293
inline bool operator==(View<T> const& lhs, View<T> const& rhs) {
306294
return lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin());

DataFormats/Common/src/View.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@ namespace edm {
1818
return p;
1919
}
2020

21-
ViewBase::ViewBase() {}
22-
23-
ViewBase::ViewBase(ViewBase const&) {}
24-
2521
} // namespace edm

DataFormats/Common/test/ptr_t.cppunit.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ void testPtr::constructTest() {
206206
Ptr<Dummy> copyPtr(dummy2Ptr);
207207
CPPUNIT_ASSERT(dummy2Ptr.key() == copyPtr.key());
208208
CPPUNIT_ASSERT(dummy2Ptr.get() == static_cast<const Dummy*>(dummy2Ptr.get()));
209+
210+
Ptr<Dummy> movePtr(std::move(copyPtr));
211+
CPPUNIT_ASSERT(dummy2Ptr.key() == movePtr.key());
209212
}
210213
}
211214

DataFormats/Common/test/reftobaseprod_t.cppunit.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ void testRefToBaseProd::constructTest() {
173173

174174
CPPUNIT_ASSERT(dummyPtr2.id() == pid);
175175
compareTo(dummyPtr2, dummyContainer);
176+
177+
RefToBaseProd<Dummy> dummyPtr3(std::move(dummyPtr2));
178+
CPPUNIT_ASSERT(dummyPtr3.id() == pid);
179+
compareTo(dummyPtr3, dummyContainer);
176180
}
177181
}
178182

0 commit comments

Comments
 (0)