Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-15 07:45:48


"Peter Dimov" <pdimov_at_[hidden]> writes:

> Bind now supports an alternative syntax that creates fewer problems with
> MSVC 6/7. Instead of
>
> boost::bind<R>(f, ...)
>
> you can now use
>
> boost::bind(boost::type<R>(), f, ...)

Specifically, any use of explicitly-specified function template
arguments will cause MSVC6 (and 7?) to "reserve" the name of the
function template, so that it cannot be used in another namespace to
define a class template, e.g.:

   namespace lib1
   {
      template <class T> void bind(T* = 0);
      bind((int*)0); // OK
      bind<int>(); // <====== uh-oh
   }

   namespace lib2
   {
      template <class T> struct bind { }; // error appears here
   }

...which is why the alternate syntax is important if you use MSVC
6/7. If you're targeting this compiler, it's important to provide
interfaces which don't require explicit specification of function
template arguments, or libraries that use your library will impose a
hidden limitation on users.

-- 
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk