[boost-users] [ptr_container] Genericity on containers

Hi, I would like to know why is'nt that working: boost::ptr_vector<B> p1; boost::ptr_vector<B> p2; std::vector<B> v1; boost::ptr_vector pview; // add elements... p1 = p2; pview = p1; // p1 = v1; // don't work // pview = v1; // don't work It should be working, or would be interesting to get working. Thank you, Eloi Du Bois.

On Tue, Nov 23, 2010 at 10:54 AM, Eloi Du Bois
Hi,
I would like to know why is'nt that working:
boost::ptr_vector<B> p1; boost::ptr_vector<B> p2; std::vector<B> v1;
boost::ptr_vector pview;
// add elements...
p1 = p2; pview = p1; // p1 = v1; // don't work // pview = v1; // don't work
It should be working, or would be interesting to get working.
Without seeing your A's and B's it's hard to tell, but I think you're talking about this.... http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2911.pdf HTH - Rob.

Sorry, and thank you for the link.
class A
{
public:
A(): _strA("A") {}
std::string _strA;
};
class B : public A
{
public:
B(): _strB("B") {}
std::string _strB;
};
2010/11/23 Robert Jones
On Tue, Nov 23, 2010 at 10:54 AM, Eloi Du Bois
wrote: Hi,
I would like to know why is'nt that working:
boost::ptr_vector<B> p1; boost::ptr_vector<B> p2; std::vector<B> v1;
boost::ptr_vector pview;
// add elements...
p1 = p2; pview = p1; // p1 = v1; // don't work // pview = v1; // don't work
It should be working, or would be interesting to get working.
Without seeing your A's and B's it's hard to tell, but I think you're talking about this....
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2911.pdf
HTH
- Rob.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Den 23-11-2010 11:54, Eloi Du Bois skrev:
Hi,
I would like to know why is'nt that working:
boost::ptr_vector<B> p1; boost::ptr_vector<B> p2; std::vector<B> v1;
boost::ptr_vector pview;
// add elements...
p1 = p2; pview = p1; // p1 = v1; // don't work // pview = v1; // don't work
It should be working, or would be interesting to get working.
Could you try p1.assign(v1.begin(),v1.end()) pview.assign(v1.begin(),v1.end()) ? -Thorsten
participants (3)
-
Eloi Du Bois
-
Robert Jones
-
Thorsten Ottosen