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

  • Home
  • SEARCH
  • 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 8883377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:47:53+00:00 2026-06-14T20:47:53+00:00

Current C++11 standard does not support move capture of variable in lambda expression like

  • 0

Current C++11 standard does not support move capture of variable in lambda expression like

unique_ptr<int[]> msg(new int[1000000]);
async_op([&&msg] { // compile error : move capture is not supported
   /* do something */
});

Since message passing and unique ownership has some critical role in some asynchronous system design, I think move semantic should be treated as first class language semantic. But lambda doesn’t support move capture.

Of course I know that there is some workaround using move capture proxy – but I wonder the reason of decision that this functionality not to be included in the C++11 standard, despite of its importance.

  • 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-14T20:47:54+00:00Added an answer on June 14, 2026 at 8:47 pm

    The C++ spec tries to be pretty conservative. It’s really bad for the next language spec to break programs that were compliant under the previous spec.

    Move semantics took a while to mature. There were changes as late as 2009, if I recall. Meanwhile lambdas weren’t implemented in many compilers until a similar timeframe. There was no time to fill in the gaps and still release a standard in 2011, which was already very late. (Prototype the spec with the compilers, test the compilers, go back and debate the spec, draft, prototype, test, repeat. Takes a while.)

    Lambdas will be extended greatly in the next standard, gaining type deduction (auto polymorphism). Xeo mentions one potential solution to move initialization.

    Note that lambdas are only syntactic sugar. They are specified in terms of an automatically-defined class, but contain nothing you can’t do yourself. As for the present language standard, you are expected to manually flesh out that implementation when the sugar runs out.

    By the way, you can possibly work around the missing feature by capturing an old fashioned auto_ptr, which is C++03’s now-deprecated attempt at a smart pointer. It is invalidated by its own copy constructor, essentially implementing move-on-copy. But it is deprecated by C++11 and may cause warnings. You could try implementing something similar, though.

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

Sidebar

Related Questions

Can someone confirm that Python 2.6 ftplib does NOT support Unicode file names? Or
In WPF App.Current.SessionEnding must return in a few seconds, otherwise the application does not
I have the following problem. As you know ie current versions do not support
CAAnimation does not provide a mechanism for assigning callback functions other than the standard
The system I am working on does not use standard ASP.NET Auth/ Membership facilities
Current Application Server Configuration: IIS 6.0 Windows 2003 Server Standard Edition SP2 .NET Framework
Current situation: Ubuntu 8.04 server edition (live server) Postgresql 8.3.7 (from standard repositories) Postgis
I have tweaked the standard jelly template to display the current test results in
current code (not working): /^script\s*type=\text\/javascript/i.test(tagName)
The documentation of CharUnicodeInfo.GetUnicodeCategory says: Note that CharUnicodeInfo .GetUnicodeCategory does not always return the

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.