diff --git a/include/boost/python/suite/indexing/container_proxy.hpp b/include/boost/python/suite/indexing/container_proxy.hpp index 26b39e30..55394428 100755 --- a/include/boost/python/suite/indexing/container_proxy.hpp +++ b/include/boost/python/suite/indexing/container_proxy.hpp @@ -34,11 +34,13 @@ template struct identity { static T & get(T & obj) { return obj; } static T const & get(T const & obj) { return obj; } + // FIXME: should add copy, assign and destroy static members }; template struct deref { template static T & get (U & ptr) { return *ptr; } template static T const & get (U const & ptr) { return *ptr; } + // FIXME: should add copy, assign and destroy static members }; template container_proxy (Iter, Iter); + container_proxy (container_proxy const &); + container_proxy &operator= (container_proxy const &); + ~container_proxy (); + Container & container(); // Should be private? Container const &container() const; // Should be private? @@ -328,6 +334,33 @@ container_proxy insert (begin(), start, finish); } +template +container_proxy +::container_proxy (container_proxy const ©) + : myHeldType (copy.myHeldType) + , myMap () // Do *not* duplicate map +{ +} + +template +container_proxy & +container_proxy +::operator= (container_proxy const ©) +{ + // All of our contained values are about to be dis-owned + std::for_each (myMap.begin(), myMap.end(), detach_if_shared); + myMap.clear(); + myHeldType = copy.myHeldType; +} + +template +container_proxy +::~container_proxy () +{ + // All of our contained values are about to be dis-owned + std::for_each (myMap.begin(), myMap.end(), detach_if_shared); +} + template Container & container_proxy