Kai-Uwe Bux wrote:
> > #include <algorithm>
> > #include <iterator>
> > #include <iostream>
> > #include <vector>
> >
> > int main ( void ) {
> > // build a vector from ints to be read from standard input:
> > std::vector<int> i_vect ( std::istream_iterator<int>( std::cin ),
> > (std::istream_iterator<int>()) );
> > // create a dynamic array of the same size:
> > int* i_array = new int [ i_vect.size() ];
> > // and copy the elements from the vector into the array:
> > std::copy( i_vect.begin(), i_vect.end(), i_array );
> >
> > // sanity check: output the array
> > std::copy( i_array, i_array + i_vect.size(),
> > std:
stream_iterator<int>( std::cout, " " ) );
> > std::cout << '\n';
this is the output of this programme:
unix@debian:~/programming/cpp$ g++ 11.cc
11.cc: In function `int main()':
11.cc:9: error: parse error before `)' token
11.cc:11: error: request for member `size' in `i_vect', which is of
non-aggregate type `std::vector<int, std::allocator<int> > ()(...)'
11.cc:13: error: request for member `begin' in `i_vect', which is of
non-aggregate type `std::vector<int, std::allocator<int> > ()(...)'
11.cc:13: error: request for member `end' in `i_vect', which is of
non-aggregate type `std::vector<int, std::allocator<int> > ()(...)'
11.cc:16: error: request for member `size' in `i_vect', which is of
non-aggregate type `std::vector<int, std::allocator<int> > ()(...)'
unix@debian:~/programming/cpp$
BTW, i am just reading 4th chapter, C++ newbie, never did any real life
coding, so i was not able to debug the programme.