| // Boost.Function library |
| // Copyright Douglas Gregor 2008. Use, modification and |
| // distribution is subject to the Boost Software License, Version |
| // 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| // http://www.boost.org/LICENSE_1_0.txt) |
| // For more information, see http://www.boost.org |
| #include <boost/test/minimal.hpp> |
| #include <boost/function.hpp> |
| struct tried_to_copy { }; |
| struct MaybeThrowOnCopy { |
| MaybeThrowOnCopy(int value = 0) : value(value) { } |
| MaybeThrowOnCopy(const MaybeThrowOnCopy& other) : value(other.value) { |
| MaybeThrowOnCopy& operator=(const MaybeThrowOnCopy& other) { |
| int operator()() { return value; } |
| // Make sure that this function object doesn't trigger the |
| // small-object optimization in Function. |
| bool MaybeThrowOnCopy::throwOnCopy = false; |
| int test_main(int, char* []) |
| ndnboost::function0<int> f; |
| ndnboost::function0<int> g; |
| MaybeThrowOnCopy::throwOnCopy = false; |
| MaybeThrowOnCopy::throwOnCopy = true; |