]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/container/example/doc_emplace.cpp
1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2009-2013. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/container for documentation.
9 //////////////////////////////////////////////////////////////////////////////
12 #include <boost/container/list.hpp>
15 //Non-copyable and non-movable class
16 class non_copy_movable
18 non_copy_movable(const non_copy_movable
&);
19 non_copy_movable
& operator=(const non_copy_movable
&);
22 non_copy_movable(int = 0) {}
27 using namespace boost::container
;
29 //Store non-copyable and non-movable objects in a list
30 list
<non_copy_movable
> l
;
33 //A new element will be built calling non_copy_movable(int) constructor
34 l
.emplace(l
.begin(), 0);
35 assert(l
.size() == 1);
37 //A new element will be value initialized
39 assert(l
.size() == 2);