|
Boost : |
Subject: Re: [boost] Need help with workaround for MSVC bug
From: Jeffrey Hellrung (jhellrung_at_[hidden])
Date: 2009-09-17 19:27:33
Emil Dotchevski wrote:
> On MSVC, the following correct code produces error C2896: 'void
> operator ||(T,void (__cdecl *)(tag<X>))' : cannot use function
> template 'void bar(tag<X>)' as a function argument.
>
> struct foo { };
>
> template <int X>
> struct tag { };
>
> template <int X>
> void bar( tag<X> ) { }
>
> template <class T,int X>
> void operator||(T, void(*)(tag<X>)) { }
>
> int main()
> {
> foo()||bar<1>;
> }
>
> My goal is to have an operator|| overload that deduces tag<X>
> implicitly, but without using parenthesis, that is, foo()||bar<1>()
> wouldn't be satisfactory. Doesn't seem possible, but still I decided
> to ask. Any ideas?
>
> Emil Dotchevski
> Reverge Studios, Inc.
> http://www.revergestudios.com/reblog/index.php?n=ReCode
What about statically initialized pod objects, like the placeholder
arguments in phoenix or lambda?
I guess that only works if you have a (reasonably) bounded set from
which X can come from...
- Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk