
"Andy Little" <andy@servocomm.freeserve.co.uk> writes:
I can't ask my library's users to register types.
Why not? We all want decltype and auto in the language dont we? BOOST_TYPEOF is the closest we have. Show your users how to use it while we wait for language support.
Because I want to serve my users, not force them to learn about an interim solution that they won't need when the real feature comes out.
Not long to wait then, assuming upgrading is viable.... ;-)
Should I assume you're just baiting me, or what? How soon do you think everyone will be using a C++0x compiler supporting auto/decltype?
Meanwhile I have found Boost.Typeof really useful now.
I didn't say it wasn't useful; only that it's inappropriate for my purposes.
Furthermore, it's _my_ library that needs result_of, so basically I would be telling users, "if you get a cryptic error message that looks like ___________, find some of the types in it and register them with this cryptic macro."
The error messages re lack of registration are not that bad IMO.
Bad for you and bad for a user are two totally distinct things.
The only problems I had was deciding what types to register when using mpl::transform IIRC.
I'd rather that people enjoy my library than have them vent frustration at me about how unusable Boost is.
The last time I tried to use lambda I seem to remember I had to do a lot more than just register my types with one cryptic macro. I had to map my own whacky type deduction scheme to lambdas whacky type deduction scheme. See below --^-->
The difference is that IIUC lambda makes some reasonable assumptions when it doesn't know the answer -- assumptions that are appropriate to my use case, like that subtracting two values of one type yields the same type -- whereas typeof does not, and cannot. And anyway, as I've been saying, I'm *not talking about deducing the return type of an invoked lambda expression*. I'm just trying to capture the function type. Maybe Boost.Typeof is actually enough for that job; I don't know. -- Dave Abrahams Boost Consulting www.boost-consulting.com