blob: 1767c7dca422ce1cd97f8827a2ff346644413ab2 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// Boost.Function library
2
3// Copyright Douglas Gregor 2001-2003. Use, modification and
4// distribution is subject to the Boost Software License, Version
5// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7
8// For more information, see http://www.boost.org
9
10#include <boost/test/minimal.hpp>
11#include <boost/function.hpp>
12#include <stdexcept>
13
14struct stateless_integer_add {
15 int operator()(int x, int y) const { return x+y; }
16
17 void* operator new(std::size_t)
18 {
19 throw std::runtime_error("Cannot allocate a stateless_integer_add");
20 }
21
22 void* operator new(std::size_t, void* p)
23 {
24 return p;
25 }
26
27 void operator delete(void*) throw()
28 {
29 }
30};
31
32int test_main(int, char*[])
33{
34 ndnboost::function2<int, int, int> f;
35 f = stateless_integer_add();
36
37 return 0;
38}