vector<string> frame(const vector<string>& v){
vector<string> ret;
string::size_type maxlen = width(v);
string border(maxlen + 4,'*');
//write the top border
ret.push_back(border);
//write each interior row
for(vector<string>::const_iterator i = v.begin();i != v.end();++i){
ret.push_back("* " + *i + string(maxlen- (*i.size()),' ') + " *");
}
//write the bottom border
ret.push_back(border);
return ret;
}
In the for loop I am getting an error while accessing the size() member function of the string returned by iterator i ----> *i.size();
"class "std::_Vector_const_iterator>>" has no member "size"
(*i).size()
. the .
operator has higher precedence than *
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With