I was wondering, lets say I build some function like:
double median(vector<double> vec)
{
typedef vector<double>::size_type vec_sz;
vec_sz size = vec.size();
if(size == 0)
{
throw domain_error("median of an empty vector");
}
sort(vec.begin(), vec.end());
vec_sz mid = size/2;
return size % 2 == 0 ? (vec[mid] + vec[mid-1]) / 2 : vec[mid];
}
is there a method for me to auto generate a source file and a header file for this function? For instance, if I want to move this function out of the main body of the program and create a separate .cpp file for it, with it's own header file, can I just right-click the function or hit a quick key to have that happen automatically for me? If not, then lets say I already built the source file for it, can I just right-click it in there and auto generate a header for it?
[Updated on: Mon, 06 May 2019 21:06]
Report message to a moderator