So trying to make Bar non-copyable makes gcc barf. Example:
So what, STL containers allocate some ghost object, then call the copy constructor of the object? Is there a way around this?Code:
template<typename T>
class Foo
{
private:
struct Bar
{
T t_bar;
Bar() {}
Bar(T t) : t_bar(t) {}
private:
Bar(const Bar&);
};
std::list<Bar> bars;
public:
Foo(T t)
{
Bar b(t);
bars.push_back(b);
}
};
int main()
{
Foo<int> foo(1);
return 0;
}