]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/move/test/move_iterator.cpp
1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2009.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org/libs/move for documentation.
10 //////////////////////////////////////////////////////////////////////////////
11 #include <boost/move/detail/config_begin.hpp>
12 #include <boost/move/iterator.hpp>
13 #include <boost/container/vector.hpp>
14 #include <boost/core/lightweight_test.hpp>
15 #include "../example/movable.hpp"
19 namespace bc
= ::boost::container
;
20 //Default construct 10 movable objects
21 bc::vector
<movable
> v(10);
23 //Test default constructed value
24 BOOST_TEST(!v
[0].moved());
27 bc::vector
<movable
> v2
28 (boost::make_move_iterator(v
.begin()), boost::make_move_iterator(v
.end()));
30 //Test values have been moved
31 BOOST_TEST(v
[0].moved());
32 BOOST_TEST(v2
.size() == 10);
35 v
.assign(boost::make_move_iterator(v2
.begin()), boost::make_move_iterator(v2
.end()));
37 //Test values have been moved
38 BOOST_TEST(v2
[0].moved());
39 BOOST_TEST(!v
[0].moved());
41 return ::boost::report_errors();
44 #include <boost/move/detail/config_end.hpp>