414  11.     

  11.2.1      ,
   (  36),       -
  IPipe  istream.

//  11.2.1

11 class multiplier{

12   float X;

13 public:

14   multiplier(float Value) { X = Value;}

15   float &operator()(float Y) { X = (X * Y);return(X);}

16 };

17

18

19 int main(int argc,char *argv[])

20 {

21   char Value[50] ;

22   int Fd[2] ;

23   float Data;

24   vector<float> X;

25   int NumElements;

26   multiplier N(12.2);

27   strcpy(Value,getenv("Fdin")) ;

28   Fd[0] = atoi(Value);

29   strcpy(Value,getenv("Fdout")) ;

30   Fd[l] = atoi(Value);

31   if stream IPipe;

32   of stream OPipe;

33   IPipe.attach(Fd[0]);

34   OPipe.attach(Fd[1]);

35   ostream_iterator<float> OPtr(OPipe,"\n");

36   IPipe  NumElements;

37   for(int N = 0;N < NumElements;N++)

38   {

39     IPipe  Data;

40     X.push_back(Data) ;

41   }

42   OPipe  X.size()  endl;

43   transform(X.begin(),X.end(),OPtr,N) ;

44   OPipe  flush;

45   return(0) ;

46

47 }

      ,    ,
        ,
      .  -
 ( 43)     ++-
transform    multiplier.  transform -
     ,      -
  -.    -  -
 Optr,     OPipe. ,   -
   11.2.1,    "  11.2.1".