[1]: https://github.com/eliben/static-server/blob/main/internal/s...
48 karma · joined January 10, 2015
[1]: https://github.com/eliben/static-server/blob/main/internal/s...
http://flask.pocoo.org/docs/0.12/patterns/caching/
I'm not sure how this works with multiple threads though, I imagine you would have to synchronize it yourself.
All jokes aside I agree with you to some extent: C++ can be frustrating to work with, and there are a lot of quirks that make it really easy to blow your foot off.
These quirks are not without benefit though. Being able to control how memory is allocated is hugely important in performance sensitive applications where pointer chasing is not tolerable. The same can be said about r values/move semantics.
Either way I would argue that using sizeof in that way is a sketchy practise.
The code listed as "C++" is essentially C with ostreams. If I were interviewing someone and they claimed to know C++, and then used "sizeof(A) / sizeof(A[0])" to get the size of an array, I'd question how much C++ they actually knew. I understand that the focus here is mainly on problem solving and not language specific patterns, but when you advertise the site as a coding interview helper I think that the solution code should reflect that which should be written in an actual interview.
On top of this, Google does not use Cloudflare and as far as I know there have been no reports of accounts actually being comprised, only logged out. I would wager whatever maintenance routine they were carrying out accidentally invalided some user sessions.
void foo(std::function<void(int)> callback);Is it really nessecary to allocate all of the hash buckets up front? Why not initialize them to null and then allocate them as you need?
Why not use some kind of managed container like std vector to store the hash buckets? This removes the need to do explicit memory management.
Why not use std forward_list instead of rolling your own linked list? Again, this will reduce the amount of code and save you from having to do manual memory management
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(TypeName&) = delete; \
void operator=(TypeName) = delete;
Introducing a virtual base class for disabling copying introduces a vtable and un-needed inheritance.https://gist.github.com/Quinny/09e34afb1d187e43dea2f3c3b0c04...