I have a large number of elements to be stored into vector or basic string(delimited by \n). I need to search for an element and I would like to know what is faster:
In general, the class-specific find functions should be no worse than std::find, which is linear.
If speed was of the essence, A cannot be worse than be. But your B could potentially be made faster by reserving the correct number of elements prior to doing any of the push_backs.