Boost logo

Boost Users :

Subject: Re: [Boost-users] [non Boost] Template troubles.
From: Kim Kuen Tang (kuentang_at_[hidden])
Date: 2008-12-11 13:24:05


Hi all,

this is what i get from msvc 2008
'void assign(T &,const T &)' : template parameter 'T' is ambiguous
1> : see declaration of 'assign'
1> could be 'const int [4]'
1> or 'int [4]'

I hope that this help you.

Robert Jones schrieb:
> Ok, first off, this is not explicitly about Boost, which I know is
> against the
> Boost guidelines, but I hope you'll all forgive me. Indirectly it is
> through trying
> to use Boost that i've bumped into this.
>
> A little code snippet...
>
> #include <cstddef>
>
> template < typename T, std :: size_t sz >
> struct Block
> {
> typedef T type[ sz ][ sz ];
> };
>
> template < typename T >
> void assign( T & assignee, const T & value );
>
> template < typename T, std :: size_t sz >
> void assign( T ( & assignee )[ sz ], const T ( & value )[ sz ] );
>
> int main( )
> {
> Block< int, 16 > :: type a;
> const Block< int, 16 > :: type b = { };
>
> assign( a, b );
> }
>
> This compiles under Gcc & Comeau, but MS VisStudio reckons the call
> to assign in main is ambiguous. Any thoughts?
>
> Also, if I put all the template declarations in an anonymous namespace,
> Comeau
> fails to compile, while Gcc is still ok!
>
> Have we encountered this before, and is there a known work around?
>
> Thanks.
>
> - Rob.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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