Skip to content

Commit a55d56e

Browse files
authored
Merge pull request #11 from johnkeeping/catch-by-ref
Catch exceptions by const reference
2 parents e90f4a8 + a35cb29 commit a55d56e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/test-strict_fstream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void test_open(const std::string& stream_class, const std::string& stream_type,
1818
s_p->open(filename, static_cast< std::ios_base::openmode >(mode));
1919
exception_thrown = false;
2020
}
21-
catch (std::exception) {}
21+
catch (const std::exception &) {}
2222
std::cout << stream_class << " " << stream_type << " " << (set_fail_bit? "failbit" : "nofailbit") << " "
2323
<< strict_fstream::detail::static_method_holder::mode_to_string(
2424
static_cast< std::ios_base::openmode >(mode))

src/strict_fstream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct static_method_holder
136136
is_p->peek();
137137
peek_failed = is_p->fail();
138138
}
139-
catch (std::ios_base::failure e) {}
139+
catch (const std::ios_base::failure &e) {}
140140
if (peek_failed)
141141
{
142142
throw Exception(std::string("strict_fstream: open('")

0 commit comments

Comments
 (0)