Boost logo

Boost :

Subject: Re: [boost] [concept] forward declarations and `BOOST_CONCEPT_REQUIRES()`
From: Dave Abrahams (dave_at_[hidden])
Date: 2010-08-09 22:00:14


On Mon, Aug 9, 2010 at 1:03 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:
> Hello all,
>
> Can I forward declare a function template that checks concepts using
> `BOOST_CONCEPT_REQUIRES()`?
>
> In the following example, MSVC gives me an ambiguous call error when I
> try to do that... (I have not yet tried other compilers).
>
>    c00.cpp(28) : error C2668: 'all_equals' : ambiguous call to
> overloaded function
>            c00.cpp(18): could be 'bool
> all_equals<std::_Vector_iterator<_Ty,_Alloc>,double>(Iter,Iter,const T
> &)'
>            with
>            [
>                _Ty=double,
>                _Alloc=std::allocator<double>,
>                Iter=std::_Vector_iterator<double,std::allocator<double>>,
>                T=double
>            ]
>            c00.cpp(11): or 'bool
> all_equals<std::_Vector_iterator<_Ty,_Alloc>,double>(Iter,Iter,const T
> &)'
>            with
>            [
>                _Ty=double,
>                _Alloc=std::allocator<double>,
>                Iter=std::_Vector_iterator<double,std::allocator<double>>,
>                T=double
>            ]
>            while trying to match the argument list
> '(std::_Vector_iterator<_Ty,_Alloc>,
> std::_Vector_iterator<_Ty,_Alloc>, double)'
>            with
>            [
>                _Ty=double,
>                _Alloc=std::allocator<double>
>            ]
>
> Thank you very much.

Just from looking at the error message this would seem to be a
cut-and-dried case of bugs in the compiler. The "overloads" it is
saying are ambiguous are identical, meaning they're really just one
thing.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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