]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/functional/factory/test/value_factory_move.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / functional / factory / test / value_factory_move.cpp
1 /*
2 Copyright 2019 Glen Joseph Fernandes
3 (glenjofe@gmail.com)
4
5 Distributed under the Boost Software License, Version 1.0.
6 (http://www.boost.org/LICENSE_1_0.txt)
7 */
8 #include <boost/config.hpp>
9 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
10 !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
11 #include <boost/functional/value_factory.hpp>
12 #include <boost/core/lightweight_test.hpp>
13
14 class arg {
15 public:
16 explicit arg(int n)
17 : value_(n) { }
18
19 arg(arg&& a)
20 : value_(a.value_) { }
21
22 int get() const {
23 return value_;
24 }
25
26 private:
27 int value_;
28 };
29
30 class sum {
31 public:
32 explicit sum(arg&& a1, arg&& a2)
33 : value_(a1.get() + a2.get()) { }
34
35 int get() const {
36 return value_;
37 }
38
39 private:
40 int value_;
41 };
42
43 int main()
44 {
45 sum s(boost::value_factory<sum>()(arg(1), arg(2)));
46 BOOST_TEST(s.get() == 3);
47 return boost::report_errors();
48 }
49 #else
50 int main()
51 {
52 return 0;
53 }
54 #endif