MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / merge_from

Method merge_from

src/core/include/megbrain/utils/shared_set.h:66–88  ·  view source on GitHub ↗

! * \brief insert all elements in another set into this */

Source from the content-addressed store, hash-verified

64 * \brief insert all elements in another set into this
65 */
66 void merge_from(const SharedSet& rhs) {
67 if (!rhs)
68 return;
69
70 if (m_own_ptr) {
71 auto pct = m_container;
72 for (auto&& i : *rhs.m_container)
73 pct->insert(i);
74 return;
75 }
76
77 if (!m_container) {
78 m_container = rhs.m_container;
79 return;
80 }
81
82 for (auto&& i : *rhs.m_container) {
83 if (!m_container->count(i)) {
84 ensure_own();
85 m_container->insert(i);
86 }
87 }
88 }
89
90 /*!
91 * \brief membership test

Callers 4

initMethod · 0.80

Calls 2

insertMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected