In article <48dc857d.0307220718.56847ed4@posting.google.com >,
Peter _Grafenberger <peter.grafenberger@vatech-hydro.at> wrote:[color=blue]
>hi,
>
>i've some troubles compiling Bjarne Strostrup's Matrix class example
>
>
http://www.research.att.com/~bs/matrix.c
>
>under ms visual c++ 6.0 (sp4). i get a lot off errors like
>
>matrix_klasse_by_stroustup.cxx(37) : error C2143: Syntaxfehler :
>Missing ';' before '<'
>
>for code like
>
>friend bool operator==<>(const Slice_iter& p, const Slice_iter& q);[/color]
Remove the "<>"'s on the various operator members, fix the for
scoping issues, and this compiles and appears to execute just fine
under VC++6.0 and VC++7.0. (Modulo compiler whine level.)
Before I get flamed for mentioning compiler specific matters, is
this really the correct friend declaration? What were the design
decisions behind not using something like
template<> friend operator==(const Slice_iter& p, const Slice_iter& q);
instead? I'm sure Stroustrup is right, but it just looks wrong.
Some idiot (ok, me) might think that there is a C++ operator called
"==<>", instead of realizing that operator== is a template function.