function.hpp:

- Use "self_type" instead of "function" for constructing swapping temporary (Borland C++ needs it)

function_base.hpp:
  - Give empty copy constructor, default constructor, and assignment operator to empty_function_mixin (MSVC generates incorrect ones)

function_template.hpp:
  - Make Borland C++ and MSVC agree on the code (involves an extra constructor definition and careful use of self_type vs. BOOST_FUNCTION_FUNCTION)


[SVN r10619]
This commit is contained in:
Douglas Gregor
2001-07-14 19:34:14 +00:00
parent 131ed15e59
commit 3ba640809b
3 changed files with 44 additions and 22 deletions

View File

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