Thread: Lambda's - What does this mean?

  1. #1
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877

    Lambda's - What does this mean?

    Quote Originally Posted by cppreference
    Executes the body of the lambda-expression, when invoked. When accessing a variable, accesses its captured copy (for the entities captured by copy), or the original object (for the entities captured by reference). Unless the keyword mutable was used in the lambda-expression, the function-call operator is const-qualified and the objects that were captured by copy are non-modifiable from inside this operator(). The function-call operator is never volatile-qualified and not virtual.

    -Lambda functions (since C++11) - cppreference.com
    This is from a website I've been reading lately to get a better understanding of C++11 (and onward), describing lambda's. I feel a bit silly asking this, but is the bolded part saying the function-call operator is "not virtual", or is it "never not virtual" (meaning, always virtual)?

    Thanks!
    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    The sentence should be parsed as: The function-call operator is (never volatile-qualified) and (not virtual).
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Quote Originally Posted by laserlight View Post
    The sentence should be parsed as: The function-call operator is (never volatile-qualified) and (not virtual).
    Thanks Laserlight, that makes much more sense now. I guess that while I read stuff like this, I get into a mode where I try and read it with machine logic lol (too many keywords mixed in with the description I guess).
    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++11 : Lambda functions return value
    By Alexandre in forum C++ Programming
    Replies: 6
    Last Post: 09-14-2011, 01:24 PM
  2. Lambda as argument to functor
    By StainedBlue in forum C++ Programming
    Replies: 1
    Last Post: 07-02-2010, 01:59 PM
  3. c++ equivalent of c# delegate/lambda
    By duck_lee in forum C++ Programming
    Replies: 1
    Last Post: 05-03-2010, 10:56 AM
  4. Lambda functions in C?
    By black0ut in forum C Programming
    Replies: 2
    Last Post: 08-12-2009, 01:26 PM
  5. boost lambda expression
    By pheres in forum C++ Programming
    Replies: 10
    Last Post: 04-26-2007, 05:25 AM