Boost logo

Boost :

From: Ostensen, Jarl (JOstensen_at_[hidden])
Date: 2003-08-21 10:46:04

Point taken, I'll move this question elsewhere and provide a piece of sample code.


-----Original Message-----
From: David Abrahams [mailto:dave_at_[hidden]]
Sent: 21 August 2003 16:03
To: boost_at_[hidden]
Subject: [boost] Re: Newbie question

"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
Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at