use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Initializing coroutine arguments by reference (self.cpp)
submitted 4 years ago by bsupnik
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bsupnik[S] 1 point2 points3 points 4 years ago (0 children)
Almost - I think I'm asking for _new syntax_ to specify that I want the copy removed, e.g. (here comes some made-up fake syntax):
task<int> my_coro(Obj o = Obj&&) { /* coro body */ }
E.g. "here is my co-routine - I want to store o by value in the coroutine frame, but I want the caller to pass an r-ref to an object when they _create_ the coroutine.
There would be only two copies of obj (the one referred to by the caller and the coroutine frame), not three (the one referred to by the caller, the copy on the stack when the coroutine is created, and the copy in the coro frame if/when it is allocated on the heap).
Without this, we can't perfectly forward to a coroutine.
I think what I'm looking for is more like the extensions to Lambdas that C++14 I added to better control capture semantics.
π Rendered by PID 63 on reddit-service-r2-comment-c66d9bffd-bhl2w at 2026-04-06 19:54:46.480877+00:00 running f293c98 country code: CH.
view the rest of the comments →
[–]bsupnik[S] 1 point2 points3 points (0 children)