This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: valarray problem with gcc-2.95.1


Gabriel Dos Reis wrote:
[...]
> First some C++ rules recollection: when a member function is
> overloaded using 'const', the const version is selected only when the
> expression used to invoke it is 'const'.  Thus 'c[range]' in
> 
>         c[range] + c[range]
> 
> is of type slice_array<double> and not valarray<double>.

Hoops! Sorry for this...

But my second question remains, however:
even if 'c' is 'const', I get a compile error for an expression like:

         exp(c[range])

In the draft of ANSI C++ at http://www.cygnus.com/misc/wp, the
mathematical functions like cos, abs, exp... are overloaded by something
like:

template<class T> valarray<T> exp(const valarray<T>&);

I know that in libstdc++ the return types for 'operator[](slice) const'
is not strictly valarray<T>, but from chapter 26 of the draft I read:

#[...]
#4 Implementations introducing such replacement types shall provide
addi-
#  tional functions and operators as follows:
#
#  --for every functions taking a const valarray<T>&, identical
functions
#    taking the replacement types shall be added;
#[...]


Did I (once more ;-) miss something, or is this not yet implemented in
libstdc++?

Thanks again for help

		Serge

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]