Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10853: problem with detection of const_cast_from
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-12-07 23:37:45
#10853: problem with detection of const_cast_from
------------------------------------+------------------------
Reporter: Matei David <matei@â¦> | Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: intrusive
Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------+------------------------
Comment (by Matei David <matei@â¦>):
The non-template conversion function I was using (in 5 above) could do
`Ptr<A>` to `Ptr<A>` conversion by using an intermediate `Ptr<const A>`
object. The problem was not with the conversion function not being general
enough, but with the `pointer_traits` code failing while detecting the
presence of `const_cast_from`, because it involved an extra constructor
call. This extra constructor call confused the overload resolution.
I don't mind `const_cast_from` being a template, what I minded was finding
it out the hard way. Perhaps this could be better explained here:
http://www.boost.org/doc/libs/1_57_0/doc/html/boost/intrusive/pointer_traits.html
Here's a suggestion:
When defining a custom family of pointers or references to be used with BI
library, make sure the public static conversion functions accessed through
the `pointer_traits` interface (`*_cast_from` and `pointer_to`) can
properly convert between const and nonconst referred member types
__without the use of implicit constructor calls__. It is suggested these
conversions be implemented as function templates, where the template
argument is the type of the object being converted from.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10853#comment:3> 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:17 UTC