 
      
    | You are here | ibob.bg | ||
| | | | | sdowney.org | |
| | | | | A Possible Technique constexpr bool g(int lhs, int rhs) { auto& op = partial_eq; return op.ne(lhs, rhs); } Compiler Explorer with Supporting Code A trait is defined as a template var... | |
| | | | | brevzin.github.io | |
| | | | | C++17 gave us std::optional which is, in the words of a friend of mine, one of those really simple, ultra complex types - in the sense that it's very easy to understand and use properly, even for relatively inexperienced programmers... but extremely difficult to implement correctly, even for experts (another such is std::pair). Today, it's well over a thousand lines of code, most of which is critical to support even its most basic functionality. optional is the simplest sum type, and it appears in lots of different languages (and even has special syntax in Swift) under various related names - Maybe, Option, etc. - but in the languages I'm even nominally familiar with, it's about as simple to implement as it is to use. | |
| | | | | blog.knatten.org | |
| | | | | Quiz time! Which of the following programs can you expect to not compile? For bonus points, which are required by the C++ standard to not compile? Program 1 Program 2 Program 3 In case you're not familiar with static_assert, it takes a constant boolean expression, and if it evaluates to false, you get a compilation... | |
| | | | | www.integralist.co.uk | |
| | | In this post I'm going to be talking about what a generator is and how it compares to a coroutine, but to understand these two concepts (generators and coroutines) we'll need to take a step back and understand the underlying concept of an Iterator. We ultimately we'll be discussing... Iterators Why use Iterators? Iterator Implementation Iterator Example Generators Why use Generators? Generator Implementation Generator Example Generator Expressions Nested Generators (i.e. yield from) Coroutines Why use Co... | ||