
I need a transform property_b that evaluates another transform property_a and returns what property_a returns+1. Simple enough, here's what I do: struct property_a : proto::or_< proto::when< proto::terminal<_>, mpl::int_<42>()>
{};
struct property_b : proto::or_ <
proto::when< _, mpl::next
{};
The complete file is attached at the end of this message as "Working
example".
But when I move to my real application (of which I attach a very
condensed version as "Non-working example") I cannot manage to make it
compile. The code in #ifdef BUG...#endif gives an error, the #else
branch doesn't (but doesn't compute what I need, which makes the fact it
compiles secondary).
I cannot see differences, other than my terminals now being in their own
domain.
H E L P
TIA,
Maurizio
--=-=-=
Content-Type: text/x-c++src
Content-Disposition: inline; filename=test_transforms.cpp
Content-Description: Working example
#include <iostream>
#include
{};
struct property_b : proto::or_ <
// proto::when< _, property_a>
proto::when< _, mpl::next
{};
int main(int argc, char *argv[])
{
std::cout << "property A = " << property_a () (a) << std::endl;
std::cout << "property B = " << property_b () (a) << std::endl;
return 0;
}
/// Local Variables:
/// mode:c++
/// comment-column:60
/// fill-column:150
/// compile-command:"g++ -I. -I./boost -o test_transforms test_transforms.cpp"
/// c-macro-cppflags:"-C -I. -I./boost"
/// c-backslash-column:120
/// c-backslash-max-column:149
/// End:
--=-=-=
Content-Type: text/x-c++src
Content-Disposition: inline; filename=width.cpp
Content-Description: Non-working example
//* Includes
#include <iostream>
//#include <iomanip>
//#include <sstream>
#include
{};
struct my_domain : proto::domain
{};
template

Mail Delivery System wrote:
I need a transform property_b that evaluates another transform property_a and returns what property_a returns+1. Simple enough, here's what I do:
struct property_a : proto::or_< proto::when< proto::terminal<_>, mpl::int_<42>()>
{};
struct property_b : proto::or_ < proto::when< _, mpl::next
() > {};
proto::or_ in these two is unnecessary. For that matter, so is "(_)" in property_b.
The complete file is attached at the end of this message as "Working example".
But when I move to my real application (of which I attach a very condensed version as "Non-working example") I cannot manage to make it compile. The code in #ifdef BUG...#endif gives an error, the #else branch doesn't (but doesn't compute what I need, which makes the fact it compiles secondary). I cannot see differences, other than my terminals now being in their own domain.
There is an important difference, and it looks like a simple oversight.
Here is the definition of actual_width_transform in your non-working
example:
struct actual_width_transform : proto::or_<
//#define BUG
#ifdef BUG
mpl::next
{};
Again, proto::or_ is unnecessary ... you only have one alternate. But I
bet if you change the code to the following, it'll work:
struct actual_width_transform :
proto::when<_, mpl::next

Thanks a lot for your reply.
"Eric" == Eric Niebler
writes:
Eric> Mail Delivery System wrote:
>> I need a transform property_b that evaluates another transform
>> property_a and returns what property_a returns+1. Simple enough,
>> here's what I do:
>>
>> struct property_a : proto::or_< proto::when< proto::terminal<_>,
>> mpl::int_<42>()> > {};
>>
>> struct property_b : proto::or_ < proto::when< _,
>> mpl::next
participants (3)
-
Eric Niebler
-
Mail Delivery System
-
Maurizio Vitale