D
dbpokorny
Hi,
I am new to C++, and I am wondering if the following function leaks
memory:
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/join.hpp>
string format_iv(vector<int> my_ints) {
vector<string> my_strings(my_ints.size());
transform(my_ints.begin(), my_ints.end(), my_strings.begin(),
boost::lexical_cast<string, int>);
return "[" + boost::algorithm::join(my_strings, ", ") + "]";
}
In particular, are the following objects deallocated upon function
exit, or do they leak?
1. my_strings
2. the temporary returned by boost::algorithm::join
Any help much appreciated,
--David
I am new to C++, and I am wondering if the following function leaks
memory:
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/join.hpp>
string format_iv(vector<int> my_ints) {
vector<string> my_strings(my_ints.size());
transform(my_ints.begin(), my_ints.end(), my_strings.begin(),
boost::lexical_cast<string, int>);
return "[" + boost::algorithm::join(my_strings, ", ") + "]";
}
In particular, are the following objects deallocated upon function
exit, or do they leak?
1. my_strings
2. the temporary returned by boost::algorithm::join
Any help much appreciated,
--David