Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-08-21 10:02:59


"Ostensen, Jarl" <JOstensen_at_[hidden]> writes:

> In the function library the function class, (in
> function_template.hpp),

Notwithstanding that reference, this is really a marginal question for
the boost list. In the future I suggest comp.lang.c++ or suchlike.

> defines a templated single-argument
> constructor and a copy-constructor. How can the compiler ever pick
> the copy-constructor??
>
> I have experimented with something like this using the VC 7.1 compiler,
> and found that it consequently picks the templated ctor instead of the
> copy ctor. Only by using an enable_if-construct was I able to make it do
> what I wanted. (Unless it was explicit, of course.)
> Is this just an MSVC issue?

If that's really the behavior, then yes... but I seriously doubt that
it is what vc7.1 does. Are you certain?

Copy ctors are special and in fact a conforming compiler will *never*
use a templated ctor to copy an object. It always picks the
explictly-declared or implicitly-generated copy ctor.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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