This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: friend operators
- From: Gokhan Kisacikoglu <kisa at centropolisfx dot com>
- To: bernd dot speiser at uni-tuebingen dot de
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 26 Aug 2002 10:50:05 -0700
- Subject: Re: friend operators
- Organization: Centropolis Effects, LLC
- References: <3D5BDF8D.2FBB3C04@uni-tuebingen.de>
- Reply-to: kisa at centropolisfx dot com
> void operator<< (string &);
if you encapsulate it within a namespace, don't, it doesn't seem to
work, you should declare this operator globally for it to work, I've
seen this work with other compilers, but not with gcc...
Gokhan
>
> this does not work if the second operator<< is NOT a friend.
> Then I get the error message
>
> ../Quantity/Quantity.h: In instantiation of `Quantities::VariableQuantity<Units:
> :QuantityUnit<Quantities::LengthUnitClass>,Dimensions::QuantityDimension<Quantit
> ies::LengthDimensionClass> >':
> Length.h:431: instantiated from here
> ../Quantity/Quantity.h:852: invalid use of undefined type `class Quantities::Var
> iableQuantity<Units::QuantityUnit<Quantities::LengthUnitClass>,Dimensions::Quant
> ityDimension<Quantities::LengthDimensionClass> >'
> ../Quantity/Quantity.h:907: forward declaration of `class Quantities::VariableQu
> antity<Units::QuantityUnit<Quantities::LengthUnitClass>,Dimensions::QuantityDime
> nsion<Quantities::LengthDimensionClass> >'
> ../Quantity/Quantity.h:852: confused by earlier errors, bailing out
>
> when I try to instantiate the template (or, if this is not a template class, if
> I just want to use the class).
> If the second operator<< is also a friend, it compiles ok.
>