I have the following code:
#include <algorithm>
#include <vector>
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{   
    typedef vector<int> IntContainer;
    typedef IntContainer::iterator IntIterator;
    IntContainer vw;
    IntIterator i = find(vw.begin(), vw.end(), 5);
    if (i != vw.end()) 
        {
        printf("Find 5 in vector\n");   // found it
      }
        else 
        {
            printf("Couldn't find 5 in vector\n");  // couldn't found it
        }
    return 0;
}
I try to compile it on Ubuntu with gcc 4.7.1 and get the following error:
vec_test.cpp: In function ‘int main()’:
vec_test.cpp:27:46: error: no matching function for call to ‘find(std::vector<int>::iterator, std::vector<int>::iterator, int)’
vec_test.cpp:27:46: note: candidate is:
In file included from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/locale_facets.h:50:0,
                 from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/basic_ios.h:39,
                 from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ios:45,
                 from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/ostream:40,
                 from /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/iostream:40,
                 from vec_test.cpp:3:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/streambuf_iterator.h:371:5: note: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT2, std::char_traits<_CharT> > >::__type std::find(std::istreambuf_iterator<_CharT2, std::char_traits<_CharT> >, std::istreambuf_iterator<_CharT2, std::char_traits<_CharT> >, const _CharT2&)
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.1/../../../../include/c++/4.7.1/bits/streambuf_iterator.h:371:5: note:   template argument deduction/substitution failed:
vec_test.cpp:27:46: note:   ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’ is not derived from ‘std::istreambuf_iterator<_CharT2, std::char_traits<_CharT> >’
This code doesn't do anything since the vector is not initialized with any content but it should compile.
I suspect this is a gcc problem but after lots of digging I'm quit desperate. Please let me know if anyone encountered this problem and knows how to solve it.
 
     
     
    