Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-08-29 23:12:26


Oops! I forgot to attach the test file!

It's now attached.

Thanks,
Eric

Eric Friedman wrote:
> Dear Boosters,
>
> I've recently added reference support to variant. For instance, the
> following is now supported:
>
> int i = 3;
> boost::variant<int&, double&> var(i);
> i = 2;
> BOOST_CHECK( boost::get<int>(var) == 2 );
>
> However, such support required the addition of an additional variant
> constructor
>
> template <typename T> variant( T& );
>
> which subsequently determines whether to treat the passed reference as a
> reference-qua-reference or rather as a reference to some object.
>
> Unfortunately, the addition of this constructor seems to have broken
variant
> under Metrowerks in some situations. So far, I have discovered that
embedded
> variants cause a problem when implicit conversions to these embedded
> variants occur. If the preceding description is unclear, the attached file
> demonstrates the problem in code.
>
> The attached code compiles and runs successfully on MSVC 6.5, MSVC 7.1,
gcc
> 3.2, and Borland 5.5.1, but I cannot get it to compile under CodeWarrior
> 8.3. The compiler complains about "ambiguous access to overloaded
function."
>
> My first instinct is to disable reference support for CodeWarrior (as
> #defining BOOST_VARIANT_NO_REFERENCE_SUPPORT does solve the problem), but
> CodeWarrior is generally a quite conformant compiler. I therefore hope
> someone might find a workaround.
>
> Of course, I will gladly assist (in explaining variant's internals, etc.)
> anyone who steps up to the challenge.
>
> TIA,
> Eric

begin 666 test.cpp
M(VEN8VQU9&4@(F)O;W-T+W9A<FEA;G0N:'!P(@T*(VEN8VQU9&4@(F)O;W-T
M+W1E<W0O;6EN:6UA;"YH<' B#0H-"G-T<G5C="!U9'0-"GL-"GT[#0H-"FEN
M="!T97-T7VUA:6XH:6YT("P_at_8VAA<BH_at_6UTI#0I[#0H@(" @='EP961E9B!B
M;V]S=#HZ=F%R:6%N=#QI;G0^(&5M8F5D9&5D7W9A<E]T.PT*(" @('1Y<&5D
M968_at_8F]O<W0Z.G9A<FEA;G0\=61T+"!E;6)E9&1E9%]V87)?=#X@=F%R7W0[
M#0H-"B @("!C;VYS="!I;G0@=&5S=%]V86QU92 ](#,[#0H@(" @=F%R7W0@
M=F%R*'1E<W1?=F%L=64I.R O+R!I;7!L:6-I="!C;VYV97)S:6]N('1O(&5M
M8F5D9&5D7W9A<E]T#0H-"B @("!E;6)E9&1E9%]V87)?="8_at_96UB961D961?
M=F%R(#T_at_8F]O<W0Z.F=E=#QE;6)E9&1E9%]V87)?=#XH=F%R*3L-"B @("!I
M;G0_at_96UB961D961?:6YT(#T_at_8F]O<W0Z.F=E=#QI;G0^*&5M8F5D9&5D7W9A
M<BD[#0H-"B @("!"3T]35%]#2$5#2R@@96UB961D961?:6YT(#T]('1E<W1?
M=F%L=64@*3L-"@T*(" @(')E='5R;B!B;V]S=#HZ97AI=%]S=6-C97-S.PT*
#?0T*
`
end


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