Boost logo

Boost :

From: Doug Gregor (gregod_at_[hidden])
Date: 2001-05-02 14:32:45


On Wednesday 02 May 2001 12:43, you wrote:
> First let me state that function.hpp is, in my opinion, ready to be
> accepted by boost.
>
> Unfortunately it doesn't work on MSVC 7.0. :-(

:(

> C:\Projects\testbed\function_test.cpp(125) : error C2558: class
> 'boost::function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>' : no copy constructor
> available or copy constructor is declared 'explicit'
>
> C:\Projects\testbed\function_test.cpp(216) : error C2558: class
> 'boost::function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>' : no copy constructor
> available or copy constructor is declared 'explicit'
>
> C:\Projects\testbed\function_test.cpp(276) : error C2558: class
> 'boost::function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>' : no copy constructor
> available or copy constructor is declared 'explicit'
>
> C:\Projects\testbed\function_test.cpp(528) : error C2679: binary '=' : no
> operator found which takes a right-hand operand of type
> 'boost::function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9>' (or there is no acceptable
> conversion)
>
> It seems that the
>
> function(BOOST_MSVC_INCLUDE(const) Functor f)
>
> constructor shadows the copy constructor; I tried to spell it
>
> function(Functor const & f)
>
> but this broke too many other things.

Looks like Microsoft changed its (already incorrect) partial ordering rules
yet again. The problem with:

function(Functor const & f)

is, of course, function pointers. Then Functor ends up not being a pointer
type, so boost::function can't distinguish between a function pointer and a
function object. However, if the is_function metafunction from type traits
works properly on MSVC 7.0 (I can't test this), perhaps boost::function could
be adapted for MSVC 7.0:

function(Functor const & f)
{
  typedef typename IF<is_function<Functor>::value,
                                  function_ptr_tag,
                                  function_obj_tag>::type tag;
  this->assign_to(f, tag());
}

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk