
Stewart, Robert wrote:
Vicente BOTET wrote:
during the Boost.Convert after review discussion there were some proposals to use Boost.Phoenix to build the functors.
My question is what should be the name of the function that builds the functor. Some possibilities:
short s=1; long l=3; using boost::phoenix::placeholders::_1;
A- Use a different name: make_converter_to?
s=boost::make_converter_to(*short*)(_1)(l) ;
B- Use the same name in a different namespace. What about using "fp" as namespace (functional programming).
s=boost::conversion::fp::convert_to(*short*)(_1)(l) ;
C- Use the same name in the same namespace and use SFINAE/enable_if to select the correct implementation depending on the parameter.
s=boost::convert_to(*short*)(_1)(l) ;
Your examples hide the functors, which somewhat obscures your request, I think, unless I've missed something. That is, I think you're asking what to name "factory" in the following example:
auto f(factory<short>(_1)); short const s(f(static_cast<long>(3)));
Your suggestions for the "factory" call are:
A. boost::make_converter_to<short>(_1) B. boost::conversion::fp::convert_to<short>(_1) C. boost::convert_to<short>(_1)
Yes. You have understood my request.
I definitely dislike B. A isn't bad, but it should be in the boost::conversion namespace. C is very nice, but it should be in the boost::conversion namespace. The introduction of the placeholder is enough to signal that the result is a Phoenix lambda.
Even if C is the more elegant, to my taste, it introduce a dependency on Boost.Phonix even if functors are not used, and this is one thing I would like to avoid. So it seems that A is a best compromise. Best, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/Boost-Conversion-functors-namming-tp35240... Sent from the Boost - Dev mailing list archive at Nabble.com.