@@ -132,7 +132,6 @@ ait_impl ait_impl::operator++(int)
132132// ------------------------------------------------------------------------
133133
134134attributes::iterator::iterator ()
135- : pimpl_{new ait_impl (nullptr , nullptr )}
136135{
137136}
138137
@@ -163,6 +162,10 @@ attributes::iterator& attributes::iterator::operator=(const iterator& other)
163162}
164163
165164
165+ attributes::iterator::iterator (iterator&& other) = default ;
166+ attributes::iterator& attributes::iterator::operator =(iterator&& other) = default ;
167+
168+
166169void attributes::iterator::swap (iterator& other)
167170{
168171 std::swap (pimpl_, other.pimpl_ );
@@ -210,7 +213,6 @@ attributes::iterator attributes::iterator::operator++(int)
210213// ------------------------------------------------------------------------
211214
212215attributes::const_iterator::const_iterator ()
213- : pimpl_{new ait_impl (nullptr , nullptr )}
214216{
215217}
216218
@@ -247,6 +249,10 @@ attributes::const_iterator& attributes::const_iterator::operator=(const const_it
247249}
248250
249251
252+ attributes::const_iterator::const_iterator (const_iterator&& other) = default ;
253+ attributes::const_iterator& attributes::const_iterator::operator =(const_iterator&& other) = default ;
254+
255+
250256void attributes::const_iterator::swap (const_iterator& other)
251257{
252258 std::swap (pimpl_, other.pimpl_ );
@@ -355,7 +361,7 @@ const char* attributes::attr::get_value() const
355361
356362bool operator ==(const attributes::iterator& lhs, const attributes::iterator& rhs)
357363{
358- return * (lhs.pimpl_ ) == *( rhs.pimpl_ );
364+ return ait_impl::are_equal (lhs.pimpl_ . get (), rhs.pimpl_ . get () );
359365}
360366
361367bool operator !=(const attributes::iterator& lhs, const attributes::iterator& rhs)
@@ -365,7 +371,7 @@ bool operator!=(const attributes::iterator& lhs, const attributes::iterator& rhs
365371
366372bool operator ==(const attributes::const_iterator& lhs, const attributes::const_iterator& rhs)
367373{
368- return * (lhs.pimpl_ ) == *( rhs.pimpl_ );
374+ return ait_impl::are_equal (lhs.pimpl_ . get (), rhs.pimpl_ . get () );
369375}
370376
371377bool operator !=(const attributes::const_iterator& lhs, const attributes::const_iterator& rhs)
@@ -414,16 +420,35 @@ xmlAttributePtr find_default_prop(xmlNodePtr xmlnode, const char *name)
414420 return nullptr ;
415421}
416422
417- bool operator == (const ait_impl& lhs, const ait_impl& rhs)
423+ bool ait_impl::are_equal (const ait_impl* lhs, const ait_impl* rhs)
418424{
419- if (lhs.fake_ || rhs.fake_ )
420- return false ;
421- return lhs.xmlattr_ == rhs.xmlattr_ ;
422- }
425+ xmlAttrPtr lhsAttr;
426+ if (lhs)
427+ {
428+ if (lhs->fake_ )
429+ return false ;
423430
424- bool operator !=(const ait_impl& lhs, const ait_impl& rhs)
425- {
426- return !(lhs == rhs);
431+ lhsAttr = lhs->xmlattr_ ;
432+ }
433+ else
434+ {
435+ lhsAttr = nullptr ;
436+ }
437+
438+ xmlAttrPtr rhsAttr;
439+ if (rhs)
440+ {
441+ if (rhs->fake_ )
442+ return false ;
443+
444+ rhsAttr = rhs->xmlattr_ ;
445+ }
446+ else
447+ {
448+ rhsAttr = nullptr ;
449+ }
450+
451+ return lhsAttr == rhsAttr;
427452}
428453
429454} // namespace impl
0 commit comments