[smart_ptr] make_shared_array/allocate_shared_array function templates

Hi, I'm suggesting to add the following function templates to allow easy, exception-safe, creation of shared_array objects: - make_shared_array (very similar to make_shared which is used to create a shared_ptr) - allocate_shared_array (again, same functionality like allocate_shared) Is there any reason not to include these? Regards, Roman.

Roman Kecher wrote:
Hi, I'm suggesting to add the following function templates to allow easy, exception-safe, creation of shared_array objects:
- make_shared_array (very similar to make_shared which is used to create a shared_ptr) - allocate_shared_array (again, same functionality like allocate_shared)
Is there any reason not to include these?
No, there is no reason to not include them. We just need a volunteer. :-)

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 09 November 2009, Peter Dimov wrote:
Roman Kecher wrote:
Hi, I'm suggesting to add the following function templates to allow easy, exception-safe, creation of shared_array objects:
- make_shared_array (very similar to make_shared which is used to create a shared_ptr) - allocate_shared_array (again, same functionality like allocate_shared)
Is there any reason not to include these?
No, there is no reason to not include them. We just need a volunteer. :-)
Is it allright if I fix the perfect forwarding bug (https://svn.boost.org/trac/boost/ticket/2962) in make/allocate_shared before it maybe gets copied into a make/allocate_shared_array? IIRC you expressed a preference for using std::forward when I originally brought this up. Can I just assume std::forward is available if the compiler supports rvalue references? Ticket #3570 suggests this might be a problem with stlport however. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkr4SmoACgkQ5vihyNWuA4VUYQCdHWDKjLvapj1q8aNQ0GjJxfxK BbIAoLzhbWXF8tQVlMYcV8Azc8AnRDkK =nGFi -----END PGP SIGNATURE-----

Frank Mori Hess wrote:
Is it allright if I fix the perfect forwarding bug (https://svn.boost.org/trac/boost/ticket/2962) in make/allocate_shared before it maybe gets copied into a make/allocate_shared_array?
Yes of course. I wonder why I defined forward this way.
IIRC you expressed a preference for using std::forward when I originally brought this up. Can I just assume std::forward is available if the compiler supports rvalue references? Ticket #3570 suggests this might be a problem with stlport however.
Your patch is fine as it is, IMO. We'll probably need to convert the std::move uses to static_cast<T&&> as well.

On Mon, Nov 9, 2009 at 7:19 PM, Peter Dimov <pdimov@pdimov.com> wrote:
Frank Mori Hess wrote:
Is it allright if I fix the perfect forwarding bug
(https://svn.boost.org/trac/boost/ticket/2962) in make/allocate_shared before it maybe gets copied into a make/allocate_shared_array?
Yes of course. I wonder why I defined forward this way.
Alright, so after the fix is done someone will have to pick up the glove and add these. I have no idea regarding the svn updating policy, I guess not everybody can just go ahead and check in..? I would do this if I could. Roman.
participants (3)
-
Frank Mori Hess
-
Peter Dimov
-
Roman Kecher