Boost logo

Boost :

Subject: Re: [boost] [proto] subscript_wrapper and templated operator[]
From: Eric Niebler (eric_at_[hidden])
Date: 2009-01-14 17:03:52


David Deakins wrote:
> While using proto with some classes that have a templated operator[] on
> VC8 and VC9, I have run into a '2 overloads have similar conversions'
> ambiguity error (C2666). The problem seems to be with subscript_wrapper
> in detail/decltype.hpp, where neither the templated operator[] from the
> original class nor the fallback 'any operator[](any)' function in
> subscript_wrapper have priority. Any thoughts on how to tweak
> subscript_wrapper so that the 'any operator[](any)' function looks like
> a worse match than the templated operator[] and thus prevents the
> ambiguity? I attached a small test case that reproduces the problem.
> Also, for reference, I am using the proto code from the release branch
> as of a couple days ago (~12 Jan 2009).

I can reproduce this error with msvc but not with gcc. I think this may
be a msvc bug. Sadly, I don't know of a work-around. I'll give the issue
some thought.

Thanks for the report.

-- 
Eric Niebler
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