Re: [Boost-bugs] [Boost C++ Libraries] #11032: boost::offset_ptr needs explicit ctor

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11032: boost::offset_ptr needs explicit ctor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-03-12 09:21:24


#11032: boost::offset_ptr needs explicit ctor
-------------------------------+--------------------------
  Reporter: stheophil@… | Owner: igaztanaga
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: interprocess
   Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+--------------------------

Comment (by stheophil@…):

 Yes, I want it to support downcasting. Sorry.

 {{{
 offset_ptr<Base> pb = ...; offset_ptr<Derived>pd(pb);
 }}}

 Does not have to compile because, as you say, raw pointers do not support
 this conversion, but
 {{{
 offset_ptr<Base> pb = ...; offset_ptr<Derived>pd =
 static_cast<offset_ptr<Derived>>(pb);
 }}}

 should compile and by consequence

 {{{
 offset_ptr<Base> pb = ...; offset_ptr<Derived>pd =
 (offset_ptr<Derived>)pb;
 }}}

 too, which just does a static_cast if I understand correctly. Both are
 used a lot in std::list and std::map implementations of Clang and MSVC.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11032#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC