4

I did something along the lines of creating a struct for phoenix::function

struct to_upper_impl
{
  template <typename T1>
  struct result { typedef std::string type; };

  std::string operator()(const std::string & s) const
  {
    return boost::algorithm::to_upper_copy(s);
  }
};

boost::phoenix::function<to_upper_impl> to_upper;

and then using that function in my semantic actions.

I was wondering if I can use some kind of a one-liner in my semantic code instead (of creating the struct)?

Thanks!

eddi
  • 49,088
  • 6
  • 104
  • 155

1 Answers1

1

As far as I know - no.Till now there is no other ways to pass other callable type as a parameter to phoenix::function. While I experimenting with it I try to use C++11 lambdas and failed when try to call phoenix::function wiht some parameters because of the Boost.ResultOf protocol. You can see explanation in this thread: Can't call a lazy lambda function with parameters via boost::phoenix::function.

Using boost( BLL) and phoenix lambdas is not much shortener and lighter. So by now there is no good alternatives.

Community
  • 1
  • 1
Oleksandr Karaberov
  • 12,573
  • 10
  • 43
  • 70