I have a method to send email whose signature is
sendemail(Vector addr, String subject, String body)
zvector addr contains email address to which the email has to be sent.
If we have multiple, separated email addresses then we add each to
Vector and pass it. But now I want to send the email to only 1 address.
So can I pass the String email address directly to the method or need
to add single string also to the Vector?
You definitely need to instantiate a new
vector<String>and add theStringto it.Another solution would be to overload the function with a different signature:
So that a new
Vectoris still instantiated but at least you can use which one signature you prefer.