|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2007-04-16 00:44:44
Sorry for the delay. I'm back from my trip and getting caught up.
Maurizio Vitale wrote:
>
> This is a short example that shows the problem (I'm using GCC 4.1.2)
> (ARITY 1 fails for different reasons)
>
> #define BOOST_PROTO_MAX_ARITY 2
> #include <boost/xpressive/proto/proto.hpp>
> #include <boost/xpressive/proto/debug.hpp>
>
> struct udt_tag {};
> boost::proto::terminal<udt_tag>::type const udt = {{}};
>
> struct my_type : boost::proto::extends<boost::proto::terminal<udt_tag>::type, my_type> {
> my_type (int i) {};
> my_type () {};
> };
>
> int main() {
> my_type x;
>
> x(1,2);
> return 0;
> }
Ah. There's a bug in proto/debug.hpp. It's fixed now. Thanks for the report.
>
> eric.cpp(16): error: no instance of overloaded function "my_type::operator()" matches the argument list
> argument types are: (int, int)
> object type is: my_type
> x(1,2);
> ^
This is not a bug. This expression *looks* like it has arity 2, but it
actually has arity 3, the three children being x, 1 and 2. By defining
BOOST_PROTO_MAX_ARITY to 2, there is no operator() that accepts enough
arguments.
<snip>
> At the moment it seems that only terminals will require data members, but if the
> plan I outlined above is viable, expression will need additional methods (for
> converting to builtin and user-defined data types).
>
> So the reason I'm wrapping expression is to be able to add the appropriate
> conversion operators.
From later mails, it seems you now have this well in hand.
> Thanks for all the hand-holding during my first steps with proto.
No problem.
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk