dimanche 31 mai 2015

rewrite throw after function with noexcept

I have heard that in C++11 we should replace throw with noexcept after method declaration :

In C++11, you generally should use noexcept instead. The old throw specification is deprecated.

How to do it in the following code?

template <typename Object>
class Stack
{
public:

    Stack();

    Object & peek() throw(std::runtime_error);

};

Reference link

Please avoid linking to the questions which do not work for std::runtime_error

Aucun commentaire:

Enregistrer un commentaire