#include <vector> #include <string> using namespace std; size_t test (vector<string> &strings) { return strings.begin().length(); } We get this error: error: no member named 'length' in '__gnu_cxx::__normal_iterator<std::basic_string<char> *, std::vector<std::basic_string<char>, std::allocator<std::basic_string<char>>>>'; did you mean to use '->' instead of '.'? It'd be nice to say something like: error: no member named 'length' in 'vector<string>::iterator' (aka '...'); did you mean to use '->' instead of '.'? i.e. use the spelling in the declaration of vector<T>::begin, scoped to the spelling used to declare 'strings'. (If it matters, GCC doesn't do any better.)