xtd 0.2.0
Loading...
Searching...
No Matches

◆ emplace_back()

template<typename type_t >
template<typename... args_t>
reference xtd::collections::generic::list< type_t >::emplace_back ( args_t &&...  args)
inline

Appends a new element to the end of the container. The element is constructed through std::allocator_traits::construct, which typically uses placement-new to construct the element in-place at the location provided by the container. The arguments args... are forwarded to the constructor as std::forward<Args>(args)....

Parameters
argsThe arguments to forward to the constructor of the element.
Returns
A reference to the inserted element.
Remarks
If after the operation the new xtd::collections::generic::list::size() is greater than old xtd::collections::generic::list::capacity() a reallocation takes place, in which case all iterators (including the xtd::collections::generic::list::end() iterator) and all references to the elements are invalidated. Otherwise only the xtd::collections::generic::list::end() iterator is invalidated.
Examples
array_list.cpp.