Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-02-23 10:15:42


----- Original Message -----
From: "rogeeff" <rogeeff_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, February 23, 2002 10:00 AM
Subject: [boost] Re: Boost.Format final submission

> --- In boost_at_y..., Samuel Krempp <krempp_at_c...> wrote:
> > On Sat, 2002-02-23 at 04:25, Samuel Krempp wrote:
> > > Okay, I've finally accessed a MSVC6 compiler, and fixed all
> problems
> > > format2 had with this compiler.
> >
> > argh, no, false alarm, there's still an overload MSVC can't
> resolve..
> >
> > I'm still looking for a workaround..
> >
> > --
> > Samuel
>
> First of all add boost/config.hpp into format.hpp
> and make group1 constructor explicit. But you still end up with the
> following ambiguity on MSVC:
>
> template<typename T>
> struct A {
> };
>
> template<typename T>
> void foo( T const& ) {}
>
> template<typename T>
> void foo( A<T> const& ) {}
>
> int main(int, char*[])
> {
> A<int> a_int;
>
> foo( a_int );
>
> return 0;
> }
>
> error C2667: 'foo' : none of 2 overload have a best conversion
>
> Anyone knows a fix?

It depends whether 'A' is supposed to represent a user-defined type or a
template supplied by the library. If the latter, you can intrude on foo and
detect that T is an A<T> using the sizeof() trick, then dispatch as
appropriate. Otherwise, I'm afraid there's no way.

-Dave


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