Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3021

Now what's wrong with this STL code

$
0
0
Same code as last thread but different error message. I went from VC2008 to VC2012 and I'm getting this error. Not sure why. Previous error was fixed by #include <iterator> on a different computer. Current computer is generating this error.

error C2784: void STLCopy(tSTLContainer *,const tSTLContainer *)' : could not deduce template argument for 'tSTLContainer *' from 'std::vector<_Ty,_Alloc>'

Code:

template
<
        class tSTLContainer                        // The type of STL container to copy.
>
void STLCopy (tSTLContainer* outDest, const tSTLContainer* inSource)
{
        copy(inSource->begin(), inSource->end(), insert_iterator<tSTLContainer>(outDest, outDest->begin()));
}

Once again, never mind. Changing pointers to references fixed it, but I'm not sure why.

Viewing all articles
Browse latest Browse all 3021

Trending Articles