Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
3 votes
0 answers
202 views

I sometimes have function templates whose body consist of a single expression E, where the function's noexcept specifier should be noexcept(E). To my best knowledge, I need to repeat the invocation of ...
8 votes
2 answers
284 views

I haven't found a video about const all the things 1, but there's at least Con.3: By default, pass pointers and references to consts from the Cpp Core Guidelines. There's lots of presentations and ...
4 votes
1 answer
133 views

In the following code, there is a no-throw operator new for the struct TestNew. It is required to further declare it as noexcept to ensure that the constructor is not called, when operator new returns ...
Hari's user avatar
  • 1,995
7 votes
1 answer
181 views

I have some code in the following style: struct S { private: T* resource; public: S(T* r) : resource{r} { if (r == nullptr) { throw std::invalid_argument(":("...
5 votes
2 answers
152 views

I have the following C++26 function which runs some code for each field of a structure: template <typename S, typename F> constexpr auto for_each_field(S&& s, F&& f) { auto&...
4 votes
1 answer
172 views

In C++, I mark a function as noexcept in the following cases: The function itself does not throw exceptions, but its value type parameters may throw exceptions when constructing. The following code ...
2 votes
1 answer
117 views

In the standard library, the parameter type of the exception class's constructor, such as std::runtime_error, follow this pattern: runtime_error( const std::string& what_arg ); // (1) ...
Konvt's user avatar
  • 124
0 votes
0 answers
81 views

I'm not sure if it is specified in the standard that advance/dereference of standard container iterator are noexcept. GCC and MSVC consistently make them noexcept for all standard containers. But ...
1 vote
0 answers
50 views

I have a mini-personal library that I am creating and I have a wrapper functor I created in order to easily go from static invocable objects to functors. For example, for something like std::...
2 votes
1 answer
103 views

Let's say I have a class like this that can copy a value without throwing: #include <type_traits> template<typename T> requires std::is_nothrow_copy_constructible_v<T> &&...
Eternal's user avatar
  • 3,114
9 votes
1 answer
151 views

I have the following bit of code: #include <cmath> #include <stdexcept> #include <vector> void zoo(double& i) { std::vector<int> v(static_cast<std::size_t>(i)); }...
4 votes
2 answers
155 views

given the follow code: // g++ main.cpp -std=c++23 #include <type_traits> using namespace std; template<typename P> concept pointer_like = is_pointer_v<P> || requires (P p) { p....
DoZerg's user avatar
  • 323
0 votes
0 answers
87 views

Please tell me if I defined the conditions for noexcept expressions correctly in this cases? class scheme_host_port { public: using value_type = std::string; scheme_host_port()...
8 votes
2 answers
361 views

TL;DR: see compilers disagree on code by Godbolt link: https://godbolt.org/z/f7G6PTEsh Should std::variant be nothrow destructible when its alternative has potentially throwing destructor? Clang and ...
4 votes
1 answer
236 views

So I wanted to improve the noexcept of some operators and functions in my code can I mark this function noexcept ? std::string remove_suffix(/*passed by copy*/ std::string s) /*noexcept*/ // is ...
user avatar

15 30 50 per page
1
2 3 4 5
...
24

AltStyle によって変換されたページ (->オリジナル) /