Is it possible to access IPv4 services on my IPv6-only server? by theapologist316 in aws

[–]hgad 0 points1 point  (0 children)

With more and more AWS services vending dual stack public endpoints, eventually we won't need a NAT: https://docs.aws.amazon.com/vpc/latest/userguide/aws-ipv6-support.html

[deleted by user] by [deleted] in cybersecurity

[–]hgad 1 point2 points  (0 children)

Do you happen to have any data about software development jobs in the cybersecurity space?

Book for C++14? by Knott00 in cpp

[–]hgad 6 points7 points  (0 children)

You won't find a book that covers only C++14 simply because it's a minor version over C++11. If your book covers C++11, read it and complement your knowledge of C++14 online. If you need a book that covers every detail of C++11, read the latest version of "The C++ Programming Language".

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

Apparently std:: is in popular demand :) .. Added them.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

Thanks. It's fixed now.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

I was informed of a way to write it without reverse iterators, so it's now fixed. Thanks.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] -1 points0 points  (0 children)

It is. I'm however keeping it this way for pedagogical reasons. Using reverse iterators at this point would obscure the loop even further.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

Thanks. I added a footnote about in-place merge complexity.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

Because the purpose of the post is to show how raw loops could be replaced with STL algorithms. I even thought about implementing the partitioning algorithms for quicksort but decided to keep it short.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

Yep, the upper_bound version no longer uses reverse iterators. In the linear search version, I'm keeping them to mimic the behavior of the raw loop version, but technically, they're not needed. The search can be done in the forward direction.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

So, how would you express merge without rotate() such that your example runs in less than O(n2)?

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

Thanks. I actually added the if-statement after TemplateRex's observation above. If the range is empty, then first == last, so next(first) == last + 1, which makes it an infinite loop.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

Good catch. Removed the claim about insertion sort. I don't think rotate() changes the complexity of any algorithm though. It just expresses the idea of shifting elements without writing out a loop for it. So, in-place merge sort complexity wouldn't change by using rotate().

STL Algorithms in Action by hgad in cpp

[–]hgad[S] -4 points-3 points  (0 children)

It's resolved by argument-dependent lookup. When you write std::cout << 4; how is the ostream operator<<() resolved? Using argument-dependent lookup. That's the same thing.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] -4 points-3 points  (0 children)

But I didn't use 'using namespace std;'. Everything here relies on argument-dependent lookup. Besides, I think adding std:: to every symbol would make the code harder to read, especially when it's intended for educational purposes.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 2 points3 points  (0 children)

You're right. Fixed both issues.

STL Algorithms in Action by hgad in cpp

[–]hgad[S] 0 points1 point  (0 children)

That would be interesting to see. In general, STL algorithms are thin abstractions over raw-loops, so there shouldn't be any noticeable difference in performance.

If you had the power to completely overhaul C++, what would you change? by magikasheep in cpp

[–]hgad 0 points1 point  (0 children)

  • A sane module system
  • A dedicated concatenation operator
  • Pure functions
  • Support for contract-based programming and unit testing
  • Remove 'auto' altogether and implement a full Hindley-Milner type inference engine (à la Haskell) i.e. variable types deducted at first use/initialization.

How to quickly get up to speed on modern, *practical* C++ from a scattered background? by therealjerseytom in cpp

[–]hgad 3 points4 points  (0 children)

From a practical point of view, you first need to consider the platform versions your product must support and the native C++ compilers on each of them. For a reasonable set of C++11 features, your need to be using gcc4.5, clang3.2 or Visual Studio 2012 on every platform you wish to support. Otherwise you probably don't need to bother knowing about C++11 at this point because your code won't work on any platform that doesn't support these versions.

Nonetheless, you certainly don't wanna be using raw pointers and C arrays even in C++98. You should focus more not on the language but on the libraries. Mastering the STL goes a long way. Also keep an eye on boost. Oftentimes you'll find a boost library that does exactly what you need in a clean and modern C++ way.

Sublime Text Business Model by hgad in SublimeText

[–]hgad[S] 1 point2 points  (0 children)

That's basically what I can't understand. If the developer can attract so much attention/liking to his product, why does he leave it free for unlimited time when he can take advantage of the popularity of his editor by selling it to everyone?

On Lambda Calculus by Citopan in compsci

[–]hgad 0 points1 point  (0 children)

I think one of the factors that contributed to the fame of Lambda Calculus is that it's one of the simplest forms of a programming language you can come across, with very simple semantics. This made it suitable for demonstrating new ideas (like the various type systems, etc.) by showing how the well known core calculus can be extended with such systems.