Sign in to follow this  

Whats wrong with this code? (C++ programming STL lib)

Recommended Posts

#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;

const int AMOUNT = 10;

int main() {
    vector<int>  vector1(AMOUNT);
    int startvar[AMOUNT] = {1,2,3,4,5,6,7,8,9,10};
    vector1.assign(startvar, startvar + AMOUNT);
    ostream_iterator<int,char> ostream_itr(cout," "); 
    copy(vector1.begin(), vector1.end, ostream_itr);
    return 0;

When I compile it it gives me this error: C:\Dev-Cpp\test\Test.cpp In function `int main()': 16 C:\Dev-Cpp\test\Test.cpp no matching function for call to `copy( __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >,

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this