Pass a stl set by reference problem

Hi guys,

I'm having a (probably) stupid problem... Here is my scenario:

1
2
3
set<myClass> myset = aFunc(); // This aFunc returns a set<myCLass>

bFunc(myset); // bFunc definition would be like this: bFunc(const set<myClass>& __myset) 


My problem is that bFunc seams not to be cald! I can't really figure it out, it should just as simple as that, right?

Thanks in advance
It's not clear what you've done, but if you want a function that returns a set of some class, it's prototype would be:
std::set<someclass> func();

You'd use it as:
std::set<someclass> s = func();

A function that takes a set by reference is:
void func(std::set<someclass>&);

You'd use it as:
1
2
std::set<someclass> s;
func(s);
Hi, thanks for helping....

That is exactly what I did..... This is why I don't get it!

I thought it could have something to do with change in context, I have some threads running, the function that receives the set<> is running in a different thread from the function that calls it..... This way my variable (the one a reference to) would only exist inside a function scope and when I pass a reference to it, the reference would point to nothing, would this be true? If so, could this be my problem? I'm not really sure, since I tried defining the variable in header file, so it would still exists but with no luck.....

Thanks in advance
Well, thanks for the help..... I said it was a stupid problem! =P

My problem was in a framework we use, that's why I couldn't understand it.... =P

Thanks for the help!
Topic archived. No new replies allowed.