Taking function objects by value instead of as references-to-const. This does not work on MSVC6.5, so the BOOST_MSVC_ONLY macro was added to make them references-to-const for only that compiler.

- Borland C++ no longer requires hacks to make function pointers work
- On any compiler other than MSVC, free functions can be assigned to Boost.Function objects without the explicit '&'


[SVN r11943]
This commit is contained in:
Douglas Gregor
2001-12-05 22:35:32 +00:00
parent 8cbd121969
commit 083767f67a
5 changed files with 26 additions and 65 deletions

View File

@ -102,7 +102,7 @@ test_zero_args()
BOOST_TEST(v1.empty());
// Assignment to an empty function from a free function
v1 = &write_five;
v1 = write_five;
BOOST_TEST(!v1.empty());
// Invocation
@ -129,7 +129,7 @@ test_zero_args()
BOOST_TEST(global_int == 5);
// Assignment to a non-empty function from a free function
v1 = &write_three;
v1 = write_three;
BOOST_TEST(!v1.empty());
// Invocation

View File

@ -102,7 +102,7 @@ test_zero_args()
BOOST_TEST(v1.empty());
// Assignment to an empty function from a free function
v1 = &write_five;
v1 = BOOST_MSVC_ONLY(&) write_five;
BOOST_TEST(!v1.empty());
// Invocation
@ -111,7 +111,7 @@ test_zero_args()
BOOST_TEST(global_int == 5);
// Assignment to a non-empty function from a free function
v1 = &write_three;
v1 = BOOST_MSVC_ONLY(&) write_three;
BOOST_TEST(!v1.empty());
// Invocation
@ -163,7 +163,7 @@ test_zero_args()
BOOST_TEST(v2.empty());
// Assignment to an empty function from a free function
v2.set(&write_five);
v2.set(BOOST_MSVC_ONLY(&) write_five);
BOOST_TEST(v2);
// Invocation
@ -172,7 +172,7 @@ test_zero_args()
BOOST_TEST(global_int == 5);
// Assignment to a non-empty function from a free function
v2 = &write_three;
v2 = BOOST_MSVC_ONLY(&) write_three;
BOOST_TEST(!v2.empty());
// Invocation
@ -227,7 +227,7 @@ test_zero_args()
BOOST_TEST(global_int == 3);
// Assign to a function from a function with a function
v2 = &write_five;
v2 = BOOST_MSVC_ONLY(&) write_five;
v1 = v2;
BOOST_TEST(!v1.empty());
BOOST_TEST(!v2.empty());