When and why should you actually use noexcept in C++?
Hello colleagues! I've been writing in C++ for about a year, actively using C++11/14. I constantly see the `noexcept` keyword in code and libraries, but I don't fully understand when it should actually be used.
For example, I'm writing a simple wrapper class for working with files. Here's how I usually define methods:
```cpp
class FileWrapper {
public:
FileWrapper(const std::string& filename) : file_(fopen(filename.c_str(), "r")) {
if (!file_) throw std::runtime_error("Cannot open file");
}
~FileWrapper() {
if (file_) fclose(file_);
}
bool is_open() const { return file_ != nullptr; }
std::string read_line() {
// ... may throw an exception on read error
}
void close() {
if (file_) { fclose(file_); fi