Re: [proto] invalid use of incomplete type 'detail::uncvref...'

2011-02-28 Thread Hossein Haeri
Hi Eric,

 boost/proto/matches.hpp:391:13: error: invalid use of incomplete type 
 'struct boost::proto::detail::uncvrefarity_caller::CanBeCalledPlus2, 
 mpl_::integral_cint, 2  ::type'
 Now look at how you've defined CanBeCalled: 
 
 templatetypename Fun, typename Int 
 struct CanBeCalled;

Thanks. I added another specialisation for mpl::integral_cint, n  and it 
worked. But, now I'm wondering why on earth was that basically needed? I had 
never touched mpl::integral_c in my code snippet. That should have been 
generated by Proto then, right? And, in that case, may I please know why?

On the other hand, I'm wondering why GCC never nagged about the need for 
mpl::integral_cint, 1 when I wrote:

EW1InpPool, GameState, AmmoMsg()  Plus1();

In other words, why is mpl::int_n used for the above line (when n == 1), 
whereas mpl::integral_cint, n is used for the following one (when n == 2)?

(EW1InpPool, GameState, AmmoMsg() || EW1InpPool, GameState, AmmoMsg())  
Plus2();

TIA,
--Hossein


  
___
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto


Re: [proto] invalid use of incomplete type 'detail::uncvref...'

2011-02-28 Thread Eric Niebler
On 3/1/2011 3:15 AM, Hossein Haeri wrote:
 Hi Eric,
 
 boost/proto/matches.hpp:391:13: error: invalid use of incomplete
 type 'struct
 boost::proto::detail::uncvrefarity_caller::CanBeCalledPlus2, 
 mpl_::integral_cint, 2  ::type' Now look at how you've defined
 CanBeCalled:
 
 templatetypename Fun, typename Int struct CanBeCalled;
 
 Thanks. I added another specialisation for mpl::integral_cint, n 
 and it worked. But, now I'm wondering why on earth was that basically
 needed? I had never touched mpl::integral_c in my code snippet. That
 should have been generated by Proto then, right? 

No.

 And, in that case,
 may I please know why?

Somewhere in your code you're adding two MPL integers. That's just how
MPL works. Your code is assuming a particular type of Integral Constant
(mpl::int_). MPL only promises to give you /a/ MPL Integral Constant.

 On the other hand, I'm wondering why GCC never nagged about the need
 for mpl::integral_cint, 1 when I wrote:
 
 EW1InpPool, GameState, AmmoMsg()  Plus1();
 
 In other words, why is mpl::int_n used for the above line (when n
 == 1), whereas mpl::integral_cint, n is used for the following one
 (when n == 2)?
 
 (EW1InpPool, GameState, AmmoMsg() || EW1InpPool, GameState,
 AmmoMsg())  Plus2();

Probably because the former isn't doing an addition of MPL Integral
Constants.

This is an MPL gotcha. Others have complained about it on the boost
list, IIRC.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com
___
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto