[boost] intrusive_ptr wrapper for C++/CLI

36 views
Skip to first unread message

Stephen Channell

unread,
Aug 21, 2014, 7:33:39 AM8/21/14
to bo...@lists.boost.org
I do a lot of development using native C++ and managed C++/CLI, and have coded a simple smart pointer wrapper around intrusive_ptr to allow C++/CLI code to use reference counting objects without change. IntrusivePtr takes advantage of the template support engineered for gcroot<T> to implement the smart pointer. It’s a wrapper to support factory functions that return intrusive_ptr.


Whilst many would object to putting C++/CLI conditional code into boost, the smart pointer is too small to stand alone and too boost specific for Microsoft.


thoughts welcome





https://ql.codeplex.com/SourceControl/latest#IntrusivePtr/boost/IntrusivePtr.h

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Niall Douglas

unread,
Aug 21, 2014, 9:03:36 AM8/21/14
to bo...@lists.boost.org
On 20 Aug 2014 at 14:10, Stephen Channell wrote:

> I do a lot of development using native C++ and managed C++/CLI, and have
> coded a simple smart pointer wrapper around intrusive_ptr to allow
> C++/CLI code to use reference counting objects without change.
> IntrusivePtr takes advantage of the template support engineered for
> gcroot<T> to implement the smart pointer. It´s a wrapper to support
> factory functions that return intrusive_ptr.
>
> Whilst many would object to putting C++/CLI conditional code into boost,
> the smart pointer is too small to stand alone and too boost specific for
> Microsoft.

You may not be aware that Microsoft contributed WinRT support for
Boost, and that should be fully merged into Boost 1.57.

I'd suggest you hand over your idea to one of the Microsoft engineers
on this list and let them push it for you as part of their general
support of Boost. Search the archives for patches from Microsoft, you
probably don't want Stephan but you will want Steve (stgates).

Niall

--
ned Productions Limited Consulting
http://www.nedproductions.biz/
http://ie.linkedin.com/in/nialldouglas/


Stephen Channell

unread,
Aug 21, 2014, 10:18:54 AM8/21/14
to bo...@lists.boost.org
WinRT C++/CX can use intrusive_ptr directly because it is native, but C++/CLI can only hold pointers to native objects because of the CLI. intrusive_ptr is a direct alternative to the CComPtr template and COM interop, and only better when you want/need portability.. wouldn't expect MS to be interested..

Glen Fernandes

unread,
Aug 21, 2014, 11:08:31 AM8/21/14
to bo...@lists.boost.org
On Wed, Aug 20, 2014 at 7:10 AM, Stephen Channell
<steve_c...@hotmail.com> wrote:
> Whilst many would object to putting C++/CLI conditional code into boost, the smart pointer is too small to stand alone and too boost specific for Microsoft.

I feel it is too C++/CLI specific for Boost.

Is C++/CLI as a language evolving at all? The impression I had before
I left Microsoft was that it would never receive any major new
language features and was generally suggested only as a last resort
for use in conjunction with a language like C# to overcome performance
or other issues around interop.

Glen
Reply all
Reply to author
Forward
0 new messages