|
Boost : |
Subject: [boost] [proto] subscript_wrapper and templated operator[]
From: David Deakins (ddeakins_at_[hidden])
Date: 2009-01-14 13:40:32
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).
Thanks,
-Dave
#include <boost/proto/proto.hpp>
using namespace boost;
struct Abc
{
template <typename T>
void operator[](T const & t)
{
}
};
template< typename Expr >
void evaluate( Expr const & expr )
{
proto::default_context ctx;
proto::eval(expr, ctx);
}
int main()
{
Abc a;
evaluate( proto::lit(a) [ 0 ] );
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk