RE: [Boost-users] Re: MPL Question on crossing the compile \ runtimebarrier with bind | adding to boost profiler abstracted file access

-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-
"Brian Braatz" <brianb@rmtg.com> writes:
I can always pass in a functor, but what I really want for Christmas is to be able to
Tyepdef MyClass<std::ofstream, bind(&std::ofstream::open,_1,"MyFile.txt") > MyNewClass;
This doesn't work because bind returns an actual OBJECT instead of a type. (intuitively - it would be cool if I could say bind(...)::Type which would give me the TYPE of the generated functor)
SO that led me to be up until 3 am reading about mpl::lambda. I am still trying to determine if THAT can be used in place, but the dots are not connecting for me yet.
Any suggestions or directions pointed GREATLY appreciated.
[Dave Abrahams Writes:]
You want "typeof," a mythical operator not yet in the C++ language -- but many implementations support some form of it as an extension. There's a prototype typeof library in the Sandbox files area now, by Arkadiy Vertleyb and others. Check it out. I suggest you browse the recent thread on typeof in boost-devel as well.
[Brian Braatz Writes:] As always THANK YOU Dave What about the boost\Lambda.bind vs MPL bind?. Is there a way to write the Tyepdef MyClass<std::ofstream,bind(&std::ofstream::open,_1,"MyFile.txt") MyNewClass; As a MPL driven expression, or is the "typeof" the only option (I am ignoring the hand coded functor option). (I am asking partially because I am having a hard time "seeing" the difference between the MPL lambda and the boost lambda- I will keep re-reading the MPL book... :) ) (also don't get me wrong, the typeof looks very cool- I am just trying to connect the dots) ALSO I REALLY WISH I could pass strings to templates, maybe if I am lucky Santa will join the C++ committee....... Thanks again Brian

"Brian Braatz" <brianb@rmtg.com> writes:
[Brian Braatz Writes:]
As always THANK YOU Dave
What about the boost\Lambda.bind vs MPL bind?.
I don't know what you're asking.
Is there a way to write the
Tyepdef MyClass<std::ofstream,bind(&std::ofstream::open,_1,"MyFile.txt") MyNewClass;
As a MPL driven expression,
I don't know what "MPL driven" means, but...
or is the "typeof" the only option
Yes, it's the only option if you want to get the type of bind(...) into that template argument list. You need to pass it through typeof, since bind(...) is always a runtime expression.
(I am ignoring the hand coded functor option). (I am asking partially because I am having a hard time "seeing" the difference between the MPL lambda and the boost lambda-
MPL composes (compile-time) metafunctions Boost.Lambda composes (runtime) functions
I will keep re-reading the MPL book... :) ) (also don't get me wrong, the typeof looks very cool- I am just trying to connect the dots)
(do you parenthesize everything?) (just wondering.) (it's all about s-expressions)-ly y'rs, Dave -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
Brian Braatz
-
David Abrahams