Jump to content
  • Advertisement
Sign in to follow this  

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

This topic is 4994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!