Re: [boost] [unnullable_ptr] Proposal for a new library

Hi, Sorry, had many things to do. I'm having many errors when trying to compile the Test file you've put with the header. Here are some of the errors : http://rafb.net/p/TGP3FO40.html PS : I've renamed the header and put it in the boost include dir. -- Alp Mestan --- http://blog.mestan.fr/ --- http://alp.developpez.com/ --- In charge of the Qt, Algorithms and Artificial Intelligence sections on Developpez

Hmm, forgot to say I tried to compile both with g++ 3.4.5 and g++ 4.4, getting the same errors. -- Alp Mestan --- http://blog.mestan.fr/ --- http://alp.developpez.com/ --- In charge of the Qt, Algorithms and Artificial Intelligence sections on Developpez

Alp Mestan wrote:
Hi,
Sorry, had many things to do.
I'm having many errors when trying to compile the Test file you've put with the header.
Here are some of the errors : http://rafb.net/p/TGP3FO40.html
PS : I've renamed the header and put it in the boost include dir.
Hi, Thanks for the report. I get the same errors when I try to compile the unit tests with gcc 4.0.0. The problem seems to be that gcc requires the standard namespace be specified as std, rather than as ::std in the template parameter list of member templates. To solve this issue I replaced all occurrences of "::std::size_t" with "std::size_t". Now the code compiles with gcc 4.0.0. I also updated the .zip file. Regards, Angel Tsankov

Ok. I get the new version from vault and then will run some tests. I'll keep you informed. -- Alp Mestan --- http://blog.mestan.fr/ --- http://alp.developpez.com/ --- In charge of the Qt, Algorithms and Artificial Intelligence sections on Developpez

Now everything is okay. The compiler doesn't dislike your code anymore and I don't get any execution problem. However I don't see anything that would keep the nested pointer to be null. Moreover, don't you want unnullable_ptr users to have a ready-to-use copy constructor and = operator ? I'm actually wondering if using a smart pointer and adding a non-null condition checking wouldn't be prettier and faster than rewriting all from scratch. As you'vre written this class, you probably had the need of writing such a class. Can you give an exemple of situation where your class would solve a problem or help a lot ? -- Alp Mestan --- http://blog.mestan.fr/ --- http://alp.developpez.com/ --- In charge of the Qt, Algorithms and Artificial Intelligence sections on Developpez

Alp Mestan wrote:
Now everything is okay. The compiler doesn't dislike your code anymore and I don't get any execution problem. I'm glad to hear that. However I don't see anything that would keep the nested pointer to be null. What do you mean? Moreover, don't you want unnullable_ptr users to have a ready-to-use copy constructor and = operator ? The class template and the specializations all have public copy assignment operators.
The copy constructor of the class template is private because its behaviour (copies the pointer stored in the passed unnullable ptr) is inconsistentfrom that of the other constructors (store a pointer to the passed object). For a more detailed explanation, see my post from 22.07.2008.
I'm actually wondering if using a smart pointer and adding a non-null condition checking wouldn't be prettier and faster than rewriting all from scratch.
That would add CPU overhead. unnullable_ptr avoids this. For a description of the purposes of unnullable_ptr and the restrictions I've imposed on it, please see my first post.
As you'vre written this class, you probably had the need of writing such a class. Can you give an exemple of situation where your class would solve a problem or help a lot ?
Yes, I often need a copyable member reference or alternatively a non-null member pointer. Another application of unnullable_ptr is in defensive programming. For instance, the throw version of 'operator new' never returns NULL, so why not make this explicit and make it return unnullable_ptr<void>?! (This is just an example, do not take this as an attempt to change the standard.) Regards, Angel Tsankov

I've read with more attention your code and have nothing to notice you. Now I'll try to make my own tests trying to use it in appropriated contexts. But I don't think I'll find something wrong. Do you plan to add/modify things in unnullable_ptr ? -- Alp Mestan --- http://blog.mestan.fr/ --- http://alp.developpez.com/ --- In charge of the Qt, Algorithms and Artificial Intelligence sections on Developpez

Alp Mestan wrote:
I've read with more attention your code and have nothing to notice you.
Now I'll try to make my own tests trying to use it in appropriated contexts. But I don't think I'll find something wrong.
Great! Could you please keep me informed how the tests are going on. I'm especially interested in contexts of application, possible or encountered problems, and possible extensions or additions.
Do you plan to add/modify things in unnullable_ptr ?
I've been developing unnullable_ptr (as well as using it in different software applications) for several years and it has undergone some modifications. However, the latest version (the one in the Vault) has been in existence for long enough time to say that it fulfills all my (current) needs and meets all the requirements that I demand from it. That is to say that currently I have no plans to change anything in it. Regards, Angel Tsankov

Angel Tsankov wrote:
Alp Mestan wrote:
I've read with more attention your code and have nothing to notice you.
Now I'll try to make my own tests trying to use it in appropriated contexts. But I don't think I'll find something wrong.
Great! Could you please keep me informed how the tests are going on. I'm especially interested in contexts of application, possible or encountered problems, and possible extensions or additions.
Do you plan to add/modify things in unnullable_ptr ?
I've been developing unnullable_ptr (as well as using it in different software applications) for several years and it has undergone some modifications. However, the latest version (the one in the Vault) has been in existence for long enough time to say that it fulfills all my (current) needs and meets all the requirements that I demand from it. That is to say that currently I have no plans to change anything in it. I've just added some documentation of UnnullablePtr. Neither the source code of UnnullablePtr, nor the unit tests have been changed.
Looking forward to some feedback, Angel Tsankov
participants (2)
-
Alp Mestan
-
Angel Tsankov