POV-Ray : Newsgroups : povray.unofficial.patches : Got Boost and VC10 "ambiguous shared_ptr"?...heres why Server Time
4 Dec 2024 02:55:32 EST (-0500)
  Got Boost and VC10 "ambiguous shared_ptr"?...heres why (Message 1 to 7 of 7)  
From: [GDS|Entropy]
Subject: Got Boost and VC10 "ambiguous shared_ptr"?...heres why
Date: 21 Oct 2011 15:35:01
Message: <web.4ea1c956ff55385e77e50e540@news.povray.org>
From microsoft connect:
http://connect.microsoft.com/VisualStudio/feedback/details/522404/share-ptr

Explicitly state: boost::shared_ptr

See below:
----------------------------------------------------------------------------
"Hi,

Thanks for reporting this issue. I've resolved it as By Design, because VC10 has
implemented most of the C++0x Standard Library. C++0x/VC10 provides
std::shared_ptr (and std::make_shared<T>(), etc.) in <memory>. Because the
Standard headers include each other in unspecified ways, including <iostream>
may or may not drag in <memory> and therefore may or may not make
std::shared_ptr visible. When both std::shared_ptr and boost::shared_ptr are
visible, and using-directives for both namespace std and namespace boost are in
scope, you need to explicitly qualify std::shared_ptr or boost::shared_ptr in
order to disambiguate which one you want.

(Error messages talk about std::tr1::shared_ptr because of an implementation
artifact. For backwards compatibility, we currently provide both std::shared_ptr
and std::tr1::shared_ptr. Currently, we actually define shared_ptr in std::tr1
and lift it into namespace std with a using-declaration. Thus, shared_ptr
appears to live in std, but its true name is std::tr1::shared_ptr. In the
future, for increased conformance, we'll reverse this, and in the far future we
might remove tr1 completely.)

Essentially, Boost is a victim of its own success here.

If you have any further questions, feel free to E-mail me at stl### [at] microsoftcom .

Stephan T. Lavavej
Visual C++ Libraries Developer"


Post a reply to this message

From: Warp
Subject: Re: Got Boost and VC10 "ambiguous shared_ptr"?...heres why
Date: 21 Oct 2011 15:42:21
Message: <4ea1cb1d@news.povray.org>
[GDS|Entropy] <nomail@nomail> wrote:
> Essentially, Boost is a victim of its own success here.

  Actually the problem is in the "using namespace" part. That shouldn't
be done.

-- 
                                                          - Warp


Post a reply to this message

From: [GDS|Entropy]
Subject: Re: Got Boost and VC10 "ambiguous shared_ptr"?...heres why
Date: 21 Oct 2011 16:20:01
Message: <web.4ea1d2ffe7d0aec677e50e540@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> [GDS|Entropy] <nomail@nomail> wrote:
> > Essentially, Boost is a victim of its own success here.
>
>   Actually the problem is in the "using namespace" part. That shouldn't
> be done.
>
> --
>                                                           - Warp

Even better. :)

Ian


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Got Boost and VC10 "ambiguous shared_ptr"?...heres why
Date: 21 Oct 2011 17:11:13
Message: <4ea1dff1$1@news.povray.org>
On 21.10.11 21:34, [GDS|Entropy] wrote:
>  From microsoft connect:
> http://connect.microsoft.com/VisualStudio/feedback/details/522404/share-ptr

It is actually sufficient to use a boost version aware of the TR1 
implementation of your library or to disable the TR1 / C++11 support in your 
library.

 > Explicitly state: boost::shared_ptr

That is a kludge, not a solution.

	Thorsten


Post a reply to this message

From: Warp
Subject: Re: Got Boost and VC10 "ambiguous shared_ptr"?...heres why
Date: 21 Oct 2011 17:21:25
Message: <4ea1e254@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> On 21.10.11 21:34, [GDS|Entropy] wrote:
> >  From microsoft connect:
> > http://connect.microsoft.com/VisualStudio/feedback/details/522404/share-ptr

> It is actually sufficient to use a boost version aware of the TR1 
> implementation of your library or to disable the TR1 / C++11 support in your 
> library.

>  > Explicitly state: boost::shared_ptr

> That is a kludge, not a solution.

  Because disabling support for the C++ *standard* in the compiler isn't
a kludge. Right.

  (Your position might have had more weight when shared_ptr was only part
of the TR1 extension but not yet part of the C++ standard. However, now
that it is part of the official standard, your argument is just bogus.)

  I'm sorry to say this, and not to disrespect your competence as a C++
programmer, but your stubborness with regard to the language is detrimental.
Explicit namespace qualifications in names are not "kludges". They are not
only a completely normal and standard way of programming, they are actually
the *recommended* way of programming C++ (for the precise reason to avoid
name collisions). If anything, it's the "using namespace" feature that's a
kludge, which got introduced to the first C++ standard mainly for
compatibility with pre-standard compilers (although it does have some uses
in some cases, which do not include dumping an entire namespace into the
global namespace).

-- 
                                                          - Warp


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Got Boost and VC10 "ambiguous shared_ptr"?...heres why
Date: 22 Oct 2011 01:19:01
Message: <4ea25245$1@news.povray.org>
On 21.10.11 23:21, Warp wrote:
> Thorsten Froehlich<tho### [at] trfde>  wrote:
>> On 21.10.11 21:34, [GDS|Entropy] wrote:
>>>    From microsoft connect:
>>> http://connect.microsoft.com/VisualStudio/feedback/details/522404/share-ptr
>
>> It is actually sufficient to use a boost version aware of the TR1
>> implementation of your library or to disable the TR1 / C++11 support in your
>> library.
>
>>   >  Explicitly state: boost::shared_ptr
>
>> That is a kludge, not a solution.
>
>    Because disabling support for the C++ *standard* in the compiler isn't
> a kludge. Right.

Well, if you read the thread, you will find that it dates to 12/28/2009 
11:01:38 PM and the answer dates back to 1/5/2010 at 12:28 PM. If you use 
the current boost, it shouldn't be a problem. A year and a half ago it was a 
problem because boost was behaving as designed, while the library in VC 2010 
was not. The current boost is C++11 compatible (even though the standard is 
just a few weeks old) and you can disable the C++11 features that were 
originally provided by boost.

Oh, and for the record, the answer given by the MS person wasn't the best 
one either. That answer would have been to define _HAS_CPP0X to zero in the 
project settings, which disables experimental features in VC2010. The real 
problem with this experimental features, after all, was that at various 
point in time their behavior and implementation was still in flux and 
incomplete, while that of boost was constant over time.

I also find it rather interesting that you move to a personal attack to 
support your point of view...

	Thorsten


Post a reply to this message

From: Warp
Subject: Re: Got Boost and VC10 "ambiguous shared_ptr"?...heres why
Date: 22 Oct 2011 04:52:16
Message: <4ea28440@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> Well, if you read the thread, you will find that it dates to 12/28/2009 
> 11:01:38 PM and the answer dates back to 1/5/2010 at 12:28 PM. If you use 
> the current boost, it shouldn't be a problem. A year and a half ago it was a 
> problem because boost was behaving as designed, while the library in VC 2010 
> was not. The current boost is C++11 compatible (even though the standard is 
> just a few weeks old) and you can disable the C++11 features that were 
> originally provided by boost.

  I don't see how the age of that thread has anything to do with the
correctness of your answer.

  If you write "using namespace", especially if you write two of them,
and then use unqualified names, you are consciously risking name collisions.
That was true in 2009 and it's still true today. The language hasn't
magically changed to avoid this.

  Calling the usage of fully qualified names to avoid ambiguous name
references a "kludge", while advocating things like disabling support for
a C++ standard, is exactly backwards.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.