]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/functional/factory/test/factory_with_none_t.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / functional / factory / test / factory_with_none_t.cpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2007 Tobias Schwinger
3
4 Use modification and distribution are subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
7==============================================================================*/
8
9#include <boost/functional/factory.hpp>
10#include <boost/detail/lightweight_test.hpp>
11#include <boost/none_t.hpp>
12
13#include <memory>
14
15class sum
16{
17 int val_sum;
18 public:
19 sum(int a, int b) : val_sum(a + b) { }
20
21 operator int() const { return this->val_sum; }
22};
23
24int main()
25{
26 int one = 1, two = 2;
27 {
28 sum* instance( boost::factory< sum*, boost::none_t >()(one,two) );
29 BOOST_TEST(*instance == 3);
30 }
31 {
32 std::auto_ptr<sum> instance(
33 boost::factory< std::auto_ptr<sum>, boost::none_t >()(one,two) );
34 BOOST_TEST(*instance == 3);
35 }
36 return boost::report_errors();
37}