|
Last change
on this file since 33 was
29,
checked in by landauf, 17 years ago
|
|
updated boost from 1_33_1 to 1_34_1
|
|
File size:
825 bytes
|
| Line | |
|---|
| 1 | // 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 | |
|---|
| 14 | struct 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 | |
|---|
| 32 | int test_main(int, char*[]) |
|---|
| 33 | { |
|---|
| 34 | boost::function2<int, int, int> f; |
|---|
| 35 | f = stateless_integer_add(); |
|---|
| 36 | |
|---|
| 37 | return 0; |
|---|
| 38 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.