#include <iostream>
#include<vector>
class foo
{
public:
struct bar
{
bar() {}
int bar_var;
};
operator std::vector<bar>() {
return m_list;
}
private:
std::vector<bar> m_list;
int foo_var;
};
//a function that takes a vector<bar> as parameter
void func(std::vector<foo::bar> m)
{
std::cout<<"func called"<<std::endl;
}
int main()
{
foo fObject;
//-------vvvvvvv---->passing a foo object which implicitly uses the conversion operator
func(fObject);
}