blob: 4d47f283317e6ee521c22c4031df67ef3bc6d66e [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001/*=============================================================================
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
12#include <memory>
13
14class sum
15{
16 int val_sum;
17 public:
18 sum(int a, int b) : val_sum(a + b) { }
19
20 operator int() const { return this->val_sum; }
21};
22
23int main()
24{
25 int one = 1, two = 2;
26 {
27 sum* instance( ndnboost::factory< sum* >()(one,two) );
28 BOOST_TEST(*instance == 3);
29 }
30 {
31 std::auto_ptr<sum> instance( ndnboost::factory< std::auto_ptr<sum> >()(one,two) );
32 BOOST_TEST(*instance == 3);
33 }
34 return ndnboost::report_errors();
35}
36