Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr and Visual Studio 2008 Express SP1
From: Sergey Sadovnikov (flex_ferrum_at_[hidden])
Date: 2008-11-06 12:42:07


Hello, Ryan.

Thursday, November 6, 2008 at 6:26:24 AM you wrote:

RG> Sergey Sadovnikov <flex_ferrum <at> artberg.ru> writes:
RG> [snip]
>> I understand, what 'using' is quite dangerous directive, but I use it
>> only in implementation files and never in headers. It makes source
>> code more shortly and readable.

RG> ...and ambiguous.
In some rarely cases like this.

RG> [snip]

RG> If you really don't want to qualify the names each place they're used then try
RG> just adding "using std::tr1::shared_ptr;" after all these locations where you
RG> already do "using namespace *". If I recall correctly, the using declaration
RG> will override the names from the using directives thus disambiguating it.
Unfortunately it doesn't help.

I think it would be good idea to avoid such ambiguous on the library level.
For example, in the boost/shared_ptr.hpp make following corrections:

//...
#ifdef _HAS_TR1
#include <memory>

namespace boost
{
   using std::tr1::shared_ptr;
   //... other usings
}
#else
// rest of the shared_ptr.hpp
#endif

Because of, for example, boost::shared_ptr_cast does not work with
std::tr1::shared_ptr. And I think there is not necessary to have two
different implementations of 'shared_ptr', 'bind', 'function' and other in
case when such implementation already shipped with compiler (such as
VS 2008 SP1 and gcc 4.3.x and newer).

-- 
Best Regards,
 Sergey                          mailto:ssadovnikov_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net