Better HN
topnewbestaskshowjobs
Log inSign up

s3rvac

45 karma · joined Sep 2, 2016 (10y ago) · 7 submissions

Software developer. Open source, C, C++, Python, Rust, Linux, Vim, clean code and TDD enthusiast.
Submissions

1.

When You Import a Python Package and It Is Empty(blog.petrzemek.net ↗)

1 points · by s3rvac · 6y ago · discuss

2.

Not all developers want to be managers, and that's OK(blog.petrzemek.net ↗)

3 points · by s3rvac · 7y ago · discuss

3.

On incomplete HTTP reads and the requests library in Python(blog.petrzemek.net ↗)

92 points · by s3rvac · 8y ago · 31 comments

4.

Pros and Cons of Alternative Function Syntax in C++(blog.petrzemek.net ↗)

1 points · by s3rvac · 9y ago · discuss

5.

Universal vs. Forwarding References in C++(blog.petrzemek.net ↗)

3 points · by s3rvac · 10y ago · discuss

comment 10y ago · link · parent

I have improved the example in the article to make the code less confusing. Now, a value is assigned to each element in the range and there is no function call.

comment 10y ago · link · parent

Using const auto& over const auto makes your code more robust. For example, what if you later decide to change the type of items in the vector from ints to something that is more expensive to copy? You would need to track all uses of the vector and add an ampersand there. And as for the access speed, YMMV but compilers are generally good at optimizations and will drop the reference when it would be faster to just copy the items.