Quick Q: How do I use conditional noexcept?—StackOverflow

Save to:
Instapaper Pocket Readability

The question also has a lemon-zest touch of "templates in headers" but the basic noexcept question is still the same:

Use of the noexcept specifier in function declaration and definition?

Consider the following function:

// Declaration in the .h file
class MyClass
{
    template <class T> void function(T&& x) const;
};

// Definition in the .cpp file
template <class T> void MyClass::function(T&& x) const;

I want to make this function noexcept if the type T is nothrow constructible.

How to do that? (I mean what is the syntax ?)

Add a Comment

You must sign in or register to add a comment.

Comments (0)

There are currently no comments on this entry.