prefer passing by reference over value
This commit is contained in:
parent
946397e325
commit
799768641f
@ -32,8 +32,7 @@ namespace debug {
|
||||
public:
|
||||
backtrace (void);
|
||||
|
||||
const decltype(m_frames)& frames(void) const
|
||||
{ return m_frames; }
|
||||
const auto& frames(void) const { return m_frames; }
|
||||
};
|
||||
|
||||
std::ostream&
|
||||
|
@ -72,7 +72,7 @@ addr2line (const void *addr)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
std::ostream&
|
||||
debug::operator <<(std::ostream &os, const debug::backtrace &rhs) {
|
||||
const auto frames = rhs.frames ();
|
||||
auto const &frames = rhs.frames ();
|
||||
|
||||
// We don't use the array form of unique_ptr as clang fails on ambigious constructors
|
||||
typedef std::unique_ptr<char *, decltype(&std::free)> str_t;
|
||||
|
@ -22,7 +22,7 @@ main (int, char**)
|
||||
char c_char[] = { '\0', 'b', 'c' };
|
||||
|
||||
bool success = true;
|
||||
for (auto [i, v, a, c]: util::izip (v_int, a_float, c_char)) {
|
||||
for (auto const &[i, v, a, c]: util::izip (v_int, a_float, c_char)) {
|
||||
success = success &&
|
||||
v_int[i] == v &&
|
||||
util::equal (a_float[i], a) &&
|
||||
|
Loading…
Reference in New Issue
Block a user