]>
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 //////////////////////////////////////////////////////////////////////////////
10 #include <boost/container/detail/config_begin.hpp>
11 #include <boost/container/detail/workaround.hpp>
13 #include <boost/container/list.hpp>
16 //Non-copyable and non-movable class
17 class non_copy_movable
19 non_copy_movable(const non_copy_movable
&);
20 non_copy_movable
& operator=(const non_copy_movable
&);
23 non_copy_movable(int = 0) {}
28 using namespace boost::container
;
30 //Store non-copyable and non-movable objects in a list
31 list
<non_copy_movable
> l
;
34 //A new element will be built calling non_copy_movable(int) contructor
35 l
.emplace(l
.begin(), 0);
36 assert(l
.size() == 1);
38 //A new element will be value initialized
40 assert(l
.size() == 2);
44 #include <boost/container/detail/config_end.hpp>