From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-02-22 18:33:34


Gennadiy Rozental wrote:
> "Jonathan Turkanis" <technews_at_[hidden]> wrote in message

> It does exist actually:
>
> callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {}
>
> This code works for MSVC 6.5 and MSVC 7.1. I do not have 7.0 at the
> moment? Could you try to see what could be done? I will try to check
> it myself, once I have an access to the compiler.

Okay here is a fix.

For VC7.0, the copy constructor can simply be conditionally removed. I assume
the same should be done for the higher-arity callbacks. So a conservative
solution would be:

    #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300)
        callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {}
    #endif

However, I believe this copy constructor is unnecessary, since it is identical
to the compiler generated copy-constructor, and the presence of the templated
constructor should not inhibit the compiler-generated constructor. However, some
broken compilers may not generate a copy-constructor in this case. I know that
VC6 is one of them. So you could do

    #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
        callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {}
    #endif

and similarly for the higher arities.

I tested the second solution on VC6, VC7.0, VC7.1, GCC 3.4, Intel 8.0 (Windows),
Codewarrior 8.3 and Borland 5.6.4.

Jonathan