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

@ -456,56 +456,35 @@ namespace boost {
function() : base_type() {}
template<typename Functor>
function(const Functor& f) : base_type(f) {}
function(Functor BOOST_MSVC_ONLY(const &) f) : base_type(f) {}
#ifdef __BORLANDC__
template<typename Functor> function(Functor* f) : base_type(f) {}
#endif // __BORLANDC__
function(const self_type& f) : base_type(static_cast<const base_type&>(f)){}
template<typename Functor>
function& operator=(const Functor& f)
self_type& operator=(Functor BOOST_MSVC_ONLY(const &) f)
{
self_type(f).swap(*this);
return *this;
}
#ifdef __BORLANDC__
template<typename Functor>
self_type& operator=(Functor* f)
{
self_type(f).swap(*this);
return *this;
}
#endif // __BORLANDC__
self_type& operator=(const base_type& f)
{
self_type(f).swap(*this);
return *this;
}
self_type& operator=(const self_type& f)
self_type& operator=(const self_type& f)
{
self_type(f).swap(*this);
return *this;
}
template<typename Functor>
void set(const Functor& f)
void set(Functor BOOST_MSVC_ONLY(const &) f)
{
self_type(f).swap(*this);
}
#ifdef __BORLANDC__
template<typename Functor>
void set(Functor* f)
{
self_type(f).swap(*this);
}
#endif // __BORLANDC__
void set(const base_type& f)
{
self_type(f).swap(*this);