Gernot Frisch Guest
|
Posted: Thu Sep 21, 2006 9:10 am Post subject: returning a vector |
|
|
Which method is the fastest/best:
std::vector<int> foo1()
{
std::vector<int> v;
...
reutun v;
}
std::vector<int>& foo2()
{
static std::vector<int> v;
...
reutun v;
}
void foo3(std::vector<int>&v)
{
...
}
I tend to say foo3 is the best, however foo1 and foo2 are more
"convenient". Is there any way of returning a vector as fast as with
foo3?
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);} |
|