MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / assign

Method assign

include/win/boost/container/vector.hpp:1160–1188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1158 //! <b>Complexity</b>: Linear to n.
1159 template <class InIt>
1160 void assign(InIt first, InIt last
1161 BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_or
1162 < void
1163 BOOST_MOVE_I container_detail::is_convertible<InIt BOOST_MOVE_I size_type>
1164 BOOST_MOVE_I container_detail::and_
1165 < container_detail::is_different<alloc_version BOOST_MOVE_I version_0>
1166 BOOST_MOVE_I container_detail::is_not_input_iterator<InIt>
1167 >
1168 >::type * = 0)
1169 )
1170 {
1171 //Overwrite all elements we can from [first, last)
1172 iterator cur = this->begin();
1173 const iterator end_it = this->end();
1174 for ( ; first != last && cur != end_it; ++cur, ++first){
1175 *cur = *first;
1176 }
1177
1178 if (first == last){
1179 //There are no more elements in the sequence, erase remaining
1180 T* const end_pos = this->back_raw();
1181 const size_type n = static_cast<size_type>(end_pos - container_detail::iterator_to_raw_pointer(cur));
1182 this->priv_destroy_last_n(n);
1183 }
1184 else{
1185 //There are more elements in the range, insert the remaining ones
1186 this->insert(this->cend(), first, last);
1187 }
1188 }
1189
1190 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
1191 //! <b>Effects</b>: Assigns the the range [il.begin(), il.end()) to *this.

Callers 4

vectorMethod · 0.95
vectorClass · 0.95
priv_move_assignFunction · 0.45
priv_copy_assignFunction · 0.45

Calls 12

insertMethod · 0.95
iterator_to_raw_pointerFunction · 0.85
iterator_distanceFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
cendMethod · 0.45
capacityMethod · 0.45
startMethod · 0.45
allocation_commandMethod · 0.45
deallocateMethod · 0.45
allocMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected