Boost logo

Boost Users :

Subject: Re: [Boost-users] Puzzled: compiler can't find a match for function call
From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2008-09-11 11:44:27


On Thu, Sep 11, 2008 at 05:13:15PM +0200, JOAQUIN M. LOPEZ MU?OZ wrote:
> ________________________________________
> De: boost-users-bounces_at_[hidden] [boost-users-bounces_at_[hidden]] En nombre de Zeljko Vrba [zvrba_at_[hidden]]
> Enviado el: jueves, 11 de septiembre de 2008 17:05
> Para: boost-users_at_[hidden]
> Asunto: Re: [Boost-users] Puzzled: compiler can't find a match for functioncall
>
> > Indeed it works. Could you please explain why the compiler can deduce
> > K in BF::map<BF::pair<K, int> > , but not in typename id_t<K>::type?
>
> Suppose that id_t<K1>::type == id_t<K2>::type == int (for instance). If
> we pass int, how can the compiler figure out whether it's K1 or K2 that
> has to be deduced?
>
True, but it could look into the ::type typedef, see that it depends on the
id_t template argument, and proceed in the same way as when you give it
explicitly written out type. (In fact, that's what I expected would happen,
since typedef just declares a type alias, not a new type.)

OK, I was unsuccessfully trying to make a "template-typedef". Is there
a way in which I can shorten BF::map<BF::pair<K, int> > to just something
like id_t<K>, but that works with type-deduction?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net