Scope in a lambda expression?

Auto alloc = Type::alloc; &() { alloc(); }; }.

I really like first line in body of this fnc. Thanks. And as for lambdas?

Dissapointment. You can use them in only simplest situations but who needs more advanced use have to use "named" fncs.Dissapointment. Thanks for your answer.

– There is nothing we can do Jan 17 at 11:55 @Moo-Juice in my "real example" it doesn't really work though. Reason? Alloc from Type is overloaded.

– There is nothing we can do Jan 17 at 11:58 @There, can you paste some of that (or example code) on to the end of your question to give me an idea? – Moo-Juice Jan 17 at 12:00 @Moo-Juice too many lines and two many headers. The Implementation is a separate header the Alloc is a typedef from different header and memoryManager is again in different header.

But what you can try, if you really wanna check it make alloc overloaded and you should have "the same" result as I. – There is nothing we can do Jan 17 at 12:03 @There, I'm assuming the error you get is error C3535: cannot deduce type for 'auto' from 'overloaded-function'? – Moo-Juice Jan 17 at 12:07.

I have to admit I am not quite sure, but I think is only a VS 2010 limitation and it should compile fine in C++0x (cf. Templates, typename, lambda -> dependent names not dependent? ).

I think the mechanics of what you see are like following: When defining template, types defined by template parameters are not "fully fledged" typenames in some aspects. One example demonstrating this is that while someone might expect X::Type (with X from your example) to return Foo, it does not.

You have to call the lambda. It is a functor so you need a () at the end of it to effectively call the lambda. /* Code does NOT answer question above... void run()const {//Why on earth this doesn't work?

&() { Type::alloc(); }(); //very important parenthesis if you wish to call the lambda }*/ I seem to have misread the question. Sorry. But there is already a similar post on SO Template type is not "seen" by the compiler inside a lambda And here is another link that refers to the same problem, with a quote from the standard about this.

Templates, typename, lambda -> dependent names not dependent?

– RedX Jan 17 at 10:35 This would not explain why it does not compile. – Suma Jan 17 at 10:36 Only c++0x does have lambda support... Without that the compiler will not understand the syntax? – RedX Jan 17 at 10:38 1 @There Here is a similar question, maybe it might help stackoverflow.Com/questions/4326674/… – RedX Jan 17 at 10:55.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions