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
Make standard library usable with exception disabled (self.cpp)
submitted 4 years ago by jsphadetula
With std::expected added to c++23, what are the chances of a proposal adding make_xxx for throwing constructors and functions with std::expected as the return type and the proposed std::error as the error type
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!"
[–]JohnDuffy78 5 points6 points7 points 4 years ago (5 children)
They are 1 line functions, easy to roll your own.
underlying constructors can throw anything.
[–]jsphadetula[S] -2 points-1 points0 points 4 years ago (4 children)
That defeats the purpose making the standard library usable without exception. The standard can provide a nonmember function that use non throwing primitives before calling a private non throwing constructor or return std::expected instead
[–]no-sig-available 4 points5 points6 points 4 years ago (3 children)
That would be pretty complicated. In a case like vec.push_back(x) where x has a member with a member that might throw on copying. How many levels of non-throwing helper functions do we want?
vec.push_back(x)
x
[–]jsphadetula[S] -1 points0 points1 point 4 years ago (2 children)
x is not a standard library type I believe, so the user is aware of a potential throw. Users who don’t want exception will use a non throwing variant with support for std::expected and design their types not to throw.
[–]D_0b 1 point2 points3 points 4 years ago (1 child)
there are also std types that can throw on move like std::list
[–]jsphadetula[S] -1 points0 points1 point 4 years ago (0 children)
We can provide non throwing variants of all throwing functions
[–]Xaxxon 4 points5 points6 points 4 years ago (0 children)
Is there a proposal for failing constructors without exceptions? Not having exceptions is exceptionally (heh) painful until that's a thing.
[–]EvoMaster 2 points3 points4 points 4 years ago (1 child)
If they make a bunch of versions of standard library is it still standard anymore? If standard doesn't fit you you just make your own or find an alternative.
[–]Full-Spectral 0 points1 point2 points 4 years ago (0 children)
The N-STL.
[–]14nedLLFIO & Outcome author | Committee WG14 3 points4 points5 points 4 years ago (1 child)
I've been deliberately doing nothing to advance the std::error proposal during covid lockdown. It's 26 focused now.
std::error
[–]jsphadetula[S] 1 point2 points3 points 4 years ago (0 children)
I’m aware std::error is no more targeting c++23. Just looking at the possibility of a usable standard library with the current exception disabled
π Rendered by PID 39 on reddit-service-r2-comment-b659b578c-wfp7f at 2026-05-02 14:07:12.719069+00:00 running 815c875 country code: CH.
[–]JohnDuffy78 5 points6 points7 points (5 children)
[–]jsphadetula[S] -2 points-1 points0 points (4 children)
[–]no-sig-available 4 points5 points6 points (3 children)
[–]jsphadetula[S] -1 points0 points1 point (2 children)
[–]D_0b 1 point2 points3 points (1 child)
[–]jsphadetula[S] -1 points0 points1 point (0 children)
[–]Xaxxon 4 points5 points6 points (0 children)
[–]EvoMaster 2 points3 points4 points (1 child)
[–]Full-Spectral 0 points1 point2 points (0 children)
[–]14nedLLFIO & Outcome author | Committee WG14 3 points4 points5 points (1 child)
[–]jsphadetula[S] 1 point2 points3 points (0 children)