#include <initializer_list>
#include <list>
#include <memory>
using Ints_t = std::list<std::unique_ptr<int>>;
Ints_t::value_type Build()
{
return Ints_t::value_type(new int);
}
int main()
{
Ints_t a;
a = Ints_t{Build(), Build(), Build(), Build(), Build()};
}
I2luY2x1ZGUgPGluaXRpYWxpemVyX2xpc3Q+CiNpbmNsdWRlIDxsaXN0PgojaW5jbHVkZSA8bWVtb3J5PgoKdXNpbmcgSW50c190ID0gc3RkOjpsaXN0PHN0ZDo6dW5pcXVlX3B0cjxpbnQ+PjsKCkludHNfdDo6dmFsdWVfdHlwZSBCdWlsZCgpCnsKICAgIHJldHVybiBJbnRzX3Q6OnZhbHVlX3R5cGUobmV3IGludCk7Cn0KCmludCBtYWluKCkKewogICAgSW50c190IGE7CiAgICBhID0gSW50c190e0J1aWxkKCksIEJ1aWxkKCksIEJ1aWxkKCksIEJ1aWxkKCksIEJ1aWxkKCl9Owp9Cg==
In file included from /usr/include/c++/4.7/list:64:0,
from prog.cpp:2:
/usr/include/c++/4.7/bits/stl_list.h: In instantiation of ‘std::_List_node<_Tp>::_List_node(_Args&& ...) [with _Args = {const std::unique_ptr<int, std::default_delete<int> >&}; _Tp = std::unique_ptr<int>]’:
/usr/include/c++/4.7/ext/new_allocator.h:110:4: required from ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::_List_node<std::unique_ptr<int> >; _Args = {const std::unique_ptr<int, std::default_delete<int> >&}; _Tp = std::_List_node<std::unique_ptr<int> >]’
/usr/include/c++/4.7/bits/stl_list.h:503:8: required from ‘std::list<_Tp, _Alloc>::_Node* std::list<_Tp, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const std::unique_ptr<int, std::default_delete<int> >&}; _Tp = std::unique_ptr<int>; _Alloc = std::allocator<std::unique_ptr<int> >; std::list<_Tp, _Alloc>::_Node = std::_List_node<std::unique_ptr<int> >]’
/usr/include/c++/4.7/bits/stl_list.h:1533:63: required from ‘void std::list<_Tp, _Alloc>::_M_insert(std::list<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const std::unique_ptr<int, std::default_delete<int> >&}; _Tp = std::unique_ptr<int>; _Alloc = std::allocator<std::unique_ptr<int> >; std::list<_Tp, _Alloc>::iterator = std::_List_iterator<std::unique_ptr<int> >]’
/usr/include/c++/4.7/bits/stl_list.h:997:9: required from ‘void std::list<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::unique_ptr<int>; _Alloc = std::allocator<std::unique_ptr<int> >; std::list<_Tp, _Alloc>::value_type = std::unique_ptr<int>]’
/usr/include/c++/4.7/bits/stl_list.h:1466:6: required from ‘void std::list<_Tp, _Alloc>::_M_initialize_dispatch(_InputIterator, _InputIterator, std::__false_type) [with _InputIterator = const std::unique_ptr<int>*; _Tp = std::unique_ptr<int>; _Alloc = std::allocator<std::unique_ptr<int> >]’
/usr/include/c++/4.7/bits/stl_list.h:606:9: required from ‘std::list<_Tp, _Alloc>::list(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::unique_ptr<int>; _Alloc = std::allocator<std::unique_ptr<int> >; std::list<_Tp, _Alloc>::allocator_type = std::allocator<std::unique_ptr<int> >]’
prog.cpp:15:59: required from here
/usr/include/c++/4.7/bits/stl_list.h:115:71: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = int; _Dp = std::default_delete<int>; std::unique_ptr<_Tp, _Dp> = std::unique_ptr<int>]’
In file included from /usr/include/c++/4.7/memory:86:0,
from prog.cpp:3:
/usr/include/c++/4.7/bits/unique_ptr.h:262:7: error: declared here