Is there a better way to convert to uppercase in the spirit of forcing?

I did something like 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 this function in my semantic actions.

I was wondering if I can use some kind of one-liner in semantic code instead of creating a structure?

Thanks!

+4
source share
1 answer

As far as I know, no. There is still no other way to pass another called type as a parameter to the phoenix :: function. While I'm experimenting with this, I am trying to use lambdas C ++ 11 and could not when I tried to call phoenix :: function with some parameters due to the Boost.ResultOf protocol. You can see the explanation in this thread: It is not possible to call a lazy lambda function with parameters via boost :: phoenix :: function .

The use of boost (BLL) and phoenix lambdas is not much reduced and easier, thus, by now there are no good alternatives.

+1
source

Source: https://habr.com/ru/post/1401443/


All Articles