|
Boost : |
From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-05-24 20:57:22
Thorsten Ottosen wrote:
>> I sometimes expect the correct convertibility for enable_if_convertible.
>> Well, what surprised me is that msvc fails to compile
>> value_type x = iter[c]; // 'iter[c]' returns a proxy which is convertible to value_type.
>> if value_type has such a constructor.
>>
>
> You lost me again. There is far too little context to understand it
> properly.
An iterator's bracket operator may return unspecified type(a.k.a. proxy)
which is convertible to its value_type.
It can be summarized as follows:
struct A // value_type
{
A() { }
template<class X> A(X x) { x.f(); } // (1)
};
struct B // proxy
{
operator A() const { return A(); } // (2)
};
int main() { A a = B(); }
msvc cannot compile this, preferring (1).
(I maybe found yet another msvc bug?)
So I tend to think a CopyConstructible type should implement the convertibility correctly.
Regards,
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk