transform documentation in VC++ 
Author Message
 transform documentation in VC++

Hi,
        There seems to be an error in the transfrom documentation in
VC++ 6.0. It says:

template<class InIt, class OutIt, class Unop>
    OutIt transform(InIt first, InIt last, OutIt x, Unop uop);

The first template function evaluates *(x + N) = uop(*(first + N)) once
for each N in the range [0, last - first). It then returns x + (last -
first). The call uop(*(first + N)) must not alter *(first + N).

Why should'nt the call uop(*(first + N)) alter *(first + N)? This means
that you can't do simple things such as transform(str.begin(),
str.end(), str.begin(), toupper), where the original string is changed.
I have written many programs that do this and haven't had a problem.
Just wondering now if this shouldn't be done for some reason...

Vasi



Sun, 22 Apr 2001 03:00:00 GMT  
 transform documentation in VC++
    You are misunderstanding the restriction.  In your case, uop() is *NOT*
altering it's parameter.  The rest of Transform() is doing the alteration,
and actually, it's only altering *(x+N) (the coincidence that (x+N) is the
same as (first +N) is irrelevant here).

    The restriction is saying that you cannot expect *(first+N) for be
changed, even if uop() alters it's parameter.  Exactly what is passed to
uop() is an implementation detail, with the only given is that it is equal
to *(first+N).  Hence, to have predictable results, uop() (acting by itself)
cannot change it's parameter.

--
Truth,
   James [MVP]
http://www.NJTheater.Com       -and-
http://www.NJTheater.Com/JamesCurran


Quote:
>The first template function evaluates *(x + N) = uop(*(first + N)) once
>for each N in the range [0, last - first). It then returns x + (last -
>first). The call uop(*(first + N)) must not alter *(first + N).

>Why should'nt the call uop(*(first + N)) alter *(first + N)? This means
>that you can't do simple things such as transform(str.begin(),
>str.end(), str.begin(), toupper), where the original string is changed.

begin 666 James M. Curran.vcf


M4DLZ.SLQ."!*;VAN(%-T+"!3=6ET92 R0CM";&]O;69I96QD.TY*.S W,# S
M+34Q-#D-"DQ!0D5,.U=/4DL[14Y#3T1)3D<]455/5$5$+5!224Y404),13HQ
M."!*;VAN(%-T+"!3=6ET92 R0CTP1#TP04)L;V]M9FEE;&0L($Y*(# W,# S
M+34Q-#D-"E523#IH='1P.B\O=W=W+DY*5&AE871E<BYC;VTO2F%M97-#=7)R
M86X-"E523#IH='1P.B\O=W=W+DY*5&AE871E<BYC;VT-"D5-04E,.U!2148[
M24Y415).150Z2F%M97-#=7)R86Y 0V]M<'5397)V92YC;VT-"E)%5CHQ.3DX

`
end


Sun, 22 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using ADO with vc++ 5.0 and need Interface documentation

2. Using ADO with vc++ 5.0 and need Interface documentation

3. Fast Fourier Transform in VC++

4. problrms on compiling the transform algorithm in release mode with VC++60

5. Looking for RDC documentation for VC++

6. DDE Documentation (Word - VC++)

7. Documentation of a VC++ Projekt

8. VC++ v5 Documentation

9. VC tutorials - is there corresponding documentation?

10. MS VC++ online documentation under Win98?..

11. How to generate documentation from a VC++ project

12. True DBGrid - Any VC++ Documentation?

 

 
Powered by phpBB® Forum Software