stl-like containers of pointers

I heard that boost is going to have all the stl-like containers, but with reference semantics and will treat the indirection in the iterators and etc... I would like to know where I can get this. It is not in the cvs either... Thanks in advance, -- Felipe Magno de Almeida UIN: 2113442 email: felipe.almeida at ic unicamp br, felipe.m.almeida at gmail com, felipe at synergy com I am a C, modern C++, MFC, ODBC, Windows Services, MAPI developer from synergy, and Computer Science student from State University of Campinas(UNICAMP). To know more about: Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br current work: http://www.mintercept.com

"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:422F35F9.60001@ic.unicamp.br... |I heard that boost is going to have all the stl-like containers, but | with reference semantics and will treat the indirection in the iterators | and etc... | I would like to know where I can get this. It is not in the cvs either... it will be in the cvs in a couple of weeks I shall think. In the mean time, you can get a beta version here. http://www.cs.aau.dk/~nesotto/ptr_container.zip br Thorsten

Is there any documentation or someone already working on it? If I can be useful, I would like to help in it. Thorsten Ottosen wrote:
"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:422F35F9.60001@ic.unicamp.br... |I heard that boost is going to have all the stl-like containers, but | with reference semantics and will treat the indirection in the iterators | and etc... | I would like to know where I can get this. It is not in the cvs either...
it will be in the cvs in a couple of weeks I shall think. In the mean time, you can get a beta version here.
http://www.cs.aau.dk/~nesotto/ptr_container.zip
br
Thorsten
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Felipe Magno de Almeida UIN: 2113442 email: felipe.almeida at ic unicamp br, felipe.m.almeida at gmail com, felipe at synergy com I am a C, modern C++, MFC, ODBC, Windows Services, MAPI developer from synergy, and Computer Science student from State University of Campinas(UNICAMP). To know more about: Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br current work: http://www.mintercept.com

"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:4230862D.6040003@ic.unicamp.br... | Is there any documentation or someone already working on it? | If I can be useful, I would like to help in it. hm..didn't the file contains a lot of docs? ((in boost/libs/ptr_container/fdocs/ ) btw, the sand-box dir is garbage, the new is in boost/ dir. As for help, then I could use some help when I finish the new docs, proof-reading and all. I'll let you know. -Thorsten

Thorsten Ottosen wrote:
"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:4230862D.6040003@ic.unicamp.br... | Is there any documentation or someone already working on it? | If I can be useful, I would like to help in it.
hm..didn't the file contains a lot of docs? ((in boost/libs/ptr_container/fdocs/ ) haha, I missed that.
btw, the sand-box dir is garbage, the new is in boost/ dir.
As for help, then I could use some help when I finish the new docs, proof-reading and all. I'll let you know. I'd be glad. And I must say, this is really great. All that I needed. I just couldnt use the assign operator here. Im not a standard expertise, but in my STL book it says vectors have assignment operator. boost::vector<A> vector1, vector2; vector1 = vector2;
-Thorsten
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Felipe Magno de Almeida UIN: 2113442 email: felipe.almeida at ic unicamp br, felipe.m.almeida at gmail com, felipe at synergy com I am a C, modern C++, MFC, ODBC, Windows Services, MAPI developer from synergy, and Computer Science student from State University of Campinas(UNICAMP). To know more about: Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br current work: http://www.mintercept.com

"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:42309EF9.1080506@ic.unicamp.br... | Thorsten Ottosen wrote: | > "Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message | > news:4230862D.6040003@ic.unicamp.br... | > | Is there any documentation or someone already working on it? | > | If I can be useful, I would like to help in it. | > | > hm..didn't the file contains a lot of docs? ((in | > boost/libs/ptr_container/fdocs/ ) | haha, I missed that. | > | > btw, the sand-box dir is garbage, the new is in boost/ dir. | > | > As for help, then I could use some help when I finish the | > new docs, proof-reading and all. I'll let you know. | I'd be glad. | And I must say, this is really great. All that I needed. | I just couldnt use the assign operator here. | Im not a standard expertise, but in my STL book it says vectors have | assignment operator. yes, but this is no ordinary std::vector. std::vector is for self-contained value types; boost::ptr_vector is for pointers whose life-time must be managed. | boost::vector<A> vector1, vector2; | vector1 = vector2; boost::ptr_vector don't have an assignment operator; it is not Assignable nor CopyConstructible. you must clone or release the container: vector1 = vector2.clone(); vector1 = vector2.release(); br Thorsten

Thorsten Ottosen wrote:
"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:42309EF9.1080506@ic.unicamp.br... | Thorsten Ottosen wrote: | > "Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message | > news:4230862D.6040003@ic.unicamp.br...
[snipped]
yes, but this is no ordinary std::vector. std::vector is for self-contained value types; boost::ptr_vector is for pointers whose life-time must be managed.
| boost::vector<A> vector1, vector2; | vector1 = vector2;
boost::ptr_vector don't have an assignment operator; it is not Assignable nor CopyConstructible.
you must clone or release the container:
vector1 = vector2.clone(); vector1 = vector2.release();
I see, but it makes impossible for use ptr_containers inside other containers. Isnt this too restrictive? Cant they be implemented in terms of these? There were a discussion about this before? So that I can know the reasons why? what I was think is that the copy constructor and the assignment operator could be part of the clone policy. Maybe Im wrong.
br
Thorsten
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Felipe Magno de Almeida UIN: 2113442 email: felipe.almeida at ic unicamp br, felipe.m.almeida at gmail com, felipe at synergy com I am a C, modern C++, MFC, ODBC, Windows Services, MAPI developer from synergy, and Computer Science student from State University of Campinas(UNICAMP). To know more about: Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br current work: http://www.mintercept.com

"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:4230A997.7090101@ic.unicamp.br... | > yes, but this is no ordinary std::vector. std::vector is for self-contained | > value types; boost::ptr_vector is for pointers whose life-time | > must be managed. | > | > | boost::vector<A> vector1, vector2; | > | vector1 = vector2; | > | > boost::ptr_vector don't have an assignment operator; it is not Assignable nor | > CopyConstructible. | > | > you must clone or release the container: | > | > vector1 = vector2.clone(); | > vector1 = vector2.release(); | > | | I see, but it makes impossible for use ptr_containers inside other | containers. Isnt this too restrictive? well, yes, you would have to use a pointer container. ptr_vector< ptr_list<Foo> > vec; vec.push_back( new ptr_list<Foo> ); when move semantics enters the langauge, they can become movable. | Cant they be implemented in terms of these? yes. | There were a discussion about this before? So that I can know the | reasons why? I can't remember any long discussion, but I know why I made the choice. The types stored in a pointer container need not be copyable; most uses will be non-copyable objects or clonable objects. Neither type of object can be copied and hence it seems wrong to allow a container of them to be copied; it kinda hides the true nature of the contained objects. Moreover, copying a whole container can be really expensive; it seems better that the distinction between copyable and clonable objects carries over to the containers as well so users are reminded of the distinction. br -Thorsten

What I was needing was a map of sets, then it wasnt compiling because of the operator[]. I modified the ptr_set for my imediate need, but I think Ill do as you said, use a pointer container. Now it really seems to me more obvious why not allow copy construction. The same as you cant push_front in a vector, I think it shouldnt be possible to copy construct a pointer container. Thorsten Ottosen wrote:
"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:4230A997.7090101@ic.unicamp.br...
| > yes, but this is no ordinary std::vector. std::vector is for self-contained | > value types; boost::ptr_vector is for pointers whose life-time | > must be managed. | > | > | boost::vector<A> vector1, vector2; | > | vector1 = vector2; | > | > boost::ptr_vector don't have an assignment operator; it is not Assignable nor | > CopyConstructible. | > | > you must clone or release the container: | > | > vector1 = vector2.clone(); | > vector1 = vector2.release(); | > | | I see, but it makes impossible for use ptr_containers inside other | containers. Isnt this too restrictive?
well, yes, you would have to use a pointer container.
ptr_vector< ptr_list<Foo> > vec; vec.push_back( new ptr_list<Foo> );
when move semantics enters the langauge, they can become movable.
| Cant they be implemented in terms of these?
yes.
| There were a discussion about this before? So that I can know the | reasons why?
I can't remember any long discussion, but I know why I made the choice.
The types stored in a pointer container need not be copyable; most uses will be non-copyable objects or clonable objects. Neither type of object can be copied and hence it seems wrong to allow a container of them to be copied; it kinda hides the true nature of the contained objects.
Moreover, copying a whole container can be really expensive; it seems better that the distinction between copyable and clonable objects carries over to the containers as well so users are reminded of the distinction.
br
-Thorsten
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Felipe Magno de Almeida UIN: 2113442 email: felipe.almeida at ic unicamp br, felipe.m.almeida at gmail com, felipe at synergy com I am a C, modern C++, MFC, ODBC, Windows Services, MAPI developer from synergy, and Computer Science student from State University of Campinas(UNICAMP). To know more about: Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br current work: http://www.mintercept.com

sorry be bothering again But I think Im seeing a bug in the documentation. But I dont know if it is the last version of the docs. The declarations of the containers says that one of the template arguments are "CloneManager = heap_clone_manager", when the correct is "class CloneAllocator = heap_clone_allocator". It is Allocator/allocator instead of Manager/manager. and is missing the last argument: "class Allocator = std::allocator<...>" I know that it is not a big deal, but.. it may complicate things for people who dont want to read the sources to see. Thorsten Ottosen wrote:
"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:4230862D.6040003@ic.unicamp.br... | Is there any documentation or someone already working on it? | If I can be useful, I would like to help in it.
hm..didn't the file contains a lot of docs? ((in boost/libs/ptr_container/fdocs/ )
btw, the sand-box dir is garbage, the new is in boost/ dir.
As for help, then I could use some help when I finish the new docs, proof-reading and all. I'll let you know.
-Thorsten
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Felipe Magno de Almeida UIN: 2113442 email: felipe.almeida at ic unicamp br, felipe.m.almeida at gmail com, felipe at synergy com I am a C, modern C++, MFC, ODBC, Windows Services, MAPI developer from synergy, and Computer Science student from State University of Campinas(UNICAMP). To know more about: Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br current work: http://www.mintercept.com

"Felipe Magno de Almeida" <felipe.almeida@ic.unicamp.br> wrote in message news:4230A478.3060103@ic.unicamp.br... | sorry be bothering again | But I think Im seeing a bug in the documentation. But I dont know if it | is the last version of the docs. the documentation is not up to date wrt. template parameters. The library was redesigned in this respect after the review. The individual member functions are almost up to date. -Thorsten
participants (2)
-
Felipe Magno de Almeida
-
Thorsten Ottosen