Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2007-07-06 03:00:11

Hi Everyone,

I've encountered a problem with MSVC which I have no idea how to go
around with regards to using extern placeholders for template method
type deductions. Let me give an example:

template <class T> struct some_type { };

struct a_type { } ;

extern a_type placeholder ;

template <class T>
some_type<T> method(T) { return some_type<T>(); };

// ...

The code works (compiles fine) in GCC -- it doesn't bother looking for
the placeholder during link time. However MSVC 8 throws a fit and
doesn't want to link the executable because it keeps looking for the
implementation of placeholder -- where the code obviously doesn't
require linking to it in any way, except for the purposes of type
deduction in the template method.

Am I encountering an MSVC bug? Is there a better way of going about this?

Insights would be most appreciated.

Thanks in advance!

Dean Michael C. Berris
mikhailberis AT gmail DOT com
+63 928 7291459

Boost list run by bdawes at, gregod at, cpdaniel at, john at