Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:58:33+00:00 2026-06-17T21:58:33+00:00

Today I was doing some catch-up on c++11 (as we have not moved on

  • 0

Today I was doing some catch-up on c++11 (as we have not moved on yet). One of the reasons to switch as stated by a lot of people seems to be lambda expressions. I am still unsure on how they offer something new.

For instance using c++11:

#include <iostream>

int main()
{
    auto func = [] () { std::cout << "Hello world" << std::endl; };

    func();
}

seems to be very similar to:

#include <iostream>

#define FUNC( )\
        do { std::cout << "Hello world" << std::endl; } while(0)


int main()
{
    FUNC();
}

What would lambda expressions offer me that I can’t currently already do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:58:34+00:00Added an answer on June 17, 2026 at 9:58 pm

    http://msdn.microsoft.com/en-us/library/vstudio/dd293608.aspx sums up the main points and more on the subject in great detail. Here is the salient excerpt:

    A lambda combines the benefits of function pointers and function
    objects and avoids their disadvantages. Like a function objects, a
    lambda is flexible and can maintain state, but unlike a function
    object, its compact syntax doesn’t require a class definition. By
    using lambdas, you can write code that’s less cumbersome and less
    prone to errors than the code for an equivalent function object.

    There are examples on the site showing more differences and comparisons.

    Also…conventional wisdom is never use macros in C++:

    http://scienceblogs.com/goodmath/2007/12/17/macros-why-theyre-evil/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was doing some reading on Cross-Site Scripting (XSS) attacks today. It seems that
I ran into a weird situation today doing some one-time sql code. This nested
Greetings I was doing some lazy initialization code today, and thought why not use
When doing some web maintenance today, I noticed a strange new folder on my
I was working on my advanced calculus homework today and we're doing some iteration
Guys; How are you doing today? I have to create a dll project on
Brains not working today and can't find a nice way of doing this. So
today i was doing some java script coding, in that i need some images
I unfortunately was doing a little code archeology today (while refactoring out some old
Ive been doing some research today on when an how to use the using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.