In response to your question in solution 2, the way you find out if your iterator is valid or not, is by comparing it to the iterator returned by the end() member function of the container. The end() iterator is comparable to NULL for stl containers. You cannot dereference this iterator, the results are similar to trying to dereference a NULL pointer.
In the original code, if you wanted to print out the message if the iterator was not valid, or as you were asking, NULL or empty, this is what it would look like:
vector<edssmsreftable_t>::iterator begin = a.begin();
if (begin == a.end())
Alternatively, if you just wanted to check if your container is empty, use the empty() member function of the stl container.