#include <iostream>
#include <list>
#include <memory>
#include <type_traits>
template <typename T>
void
fill_list(std::list<T> &l, T &&e)
{
l.push_back(std::move(e));
}
template <typename T, typename... Args>
void
fill_list(std::list<T> &l, T &&e, Args... args)
{
l.push_back(std::move(e));
fill_list(l, std::move(args)...);
}
int
main(void)
{
std::list<std::unique_ptr<int>> ints;
fill_list(ints,
std::unique_ptr<int>(new int(9)),
std::unique_ptr<int>(new int(66)));
std::cout << *ints.front() << std::endl;
std::cout << *ints.back() << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bGlzdD4KI2luY2x1ZGUgPG1lbW9yeT4KI2luY2x1ZGUgPHR5cGVfdHJhaXRzPgoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnZvaWQKZmlsbF9saXN0KHN0ZDo6bGlzdDxUPiAmbCwgVCAmJmUpCnsKICAgIGwucHVzaF9iYWNrKHN0ZDo6bW92ZShlKSk7Cn0KCnRlbXBsYXRlIDx0eXBlbmFtZSBULCB0eXBlbmFtZS4uLiBBcmdzPgp2b2lkCmZpbGxfbGlzdChzdGQ6Omxpc3Q8VD4gJmwsIFQgJiZlLCBBcmdzLi4uIGFyZ3MpCnsKICAgIGwucHVzaF9iYWNrKHN0ZDo6bW92ZShlKSk7CiAgICBmaWxsX2xpc3QobCwgc3RkOjptb3ZlKGFyZ3MpLi4uKTsKfQoKaW50Cm1haW4odm9pZCkKewogICAgc3RkOjpsaXN0PHN0ZDo6dW5pcXVlX3B0cjxpbnQ+PiBpbnRzOwogICAgZmlsbF9saXN0KGludHMsCiAgICAgICAgICAgICAgc3RkOjp1bmlxdWVfcHRyPGludD4obmV3IGludCg5KSksCiAgICAgICAgICAgICAgc3RkOjp1bmlxdWVfcHRyPGludD4obmV3IGludCg2NikpKTsKCiAgICBzdGQ6OmNvdXQgPDwgKmludHMuZnJvbnQoKSA8PCBzdGQ6OmVuZGw7CiAgICBzdGQ6OmNvdXQgPDwgKmludHMuYmFjaygpIDw8IHN0ZDo6ZW5kbDsKICAgIHJldHVybiAwOwp9Cg==