]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/move/example/copymovable.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / move / example / copymovable.hpp
CommitLineData
7c673cae
FG
1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright 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)
7//
8// See http://www.boost.org/libs/move for documentation.
9//
10//////////////////////////////////////////////////////////////////////////////
11#ifndef BOOST_MOVE_TEST_COPYMOVABLE_HPP
12#define BOOST_MOVE_TEST_COPYMOVABLE_HPP
13
14#include <boost/move/detail/config_begin.hpp>
15
16//[copy_movable_definition
17//header file "copymovable.hpp"
18#include <boost/move/core.hpp>
19
20//A copy_movable class
21class copy_movable
22{
23 BOOST_COPYABLE_AND_MOVABLE(copy_movable)
24 int value_;
25
26 public:
27 copy_movable() : value_(1){}
28
29 //Move constructor and assignment
30 copy_movable(BOOST_RV_REF(copy_movable) m)
31 { value_ = m.value_; m.value_ = 0; }
32
33 copy_movable(const copy_movable &m)
34 { value_ = m.value_; }
35
36 copy_movable & operator=(BOOST_RV_REF(copy_movable) m)
37 { value_ = m.value_; m.value_ = 0; return *this; }
38
39 copy_movable & operator=(BOOST_COPY_ASSIGN_REF(copy_movable) m)
40 { value_ = m.value_; return *this; }
41
42 bool moved() const //Observer
43 { return value_ == 0; }
44};
45
46//A copyable-only class
47class copyable
48{};
49
50//A copyable-only class
51class non_copy_movable
52{
53 public:
54 non_copy_movable(){}
55 private:
56 non_copy_movable(const non_copy_movable&);
57 non_copy_movable& operator=(const non_copy_movable&);
58};
59
60//]
61
62#include <boost/move/detail/config_end.hpp>
63
64#endif //BOOST_MOVE_TEST_COPYMOVABLE_HPP