Since it's impossible to find one concise source anywhere, as far as I can tell:
| ISO C++ Standard | Value |
|---|---|
| 1998/2003 | 199711L |
| 2011 | 201103L |
| 2014 | 201402L |
| 2017 | 201703L |
| #ifndef ONE_OF_H | |
| #define ONE_OF_H | |
| #include <tuple> | |
| #include <utility> | |
| template <class... T> | |
| struct one_of { | |
| std::tuple<T...> t; | |
| constexpr one_of(T&&... values) : t{std::forward<T>(values)...} {} |
| // TODO concepts/constraints/SFINAE to keep T as FP | |
| // TODO make this more robust than the very basics | |
| template <class T> | |
| class KahanSum { | |
| public: | |
| KahanSum() : sum_{}, err_{} {} | |
| KahanSum(T init) : sum_{init}, err_{} {} | |
| constexpr KahanSum& Add(T val) { |
| /* | |
| * Basic register map implementation in C++. Makes reading/writing registers | |
| * safer, should be just as efficient as doing things the old fashioned way. | |
| * The setup is a little ugly, but such is life. It was never going to be pretty | |
| * anyway. | |
| * | |
| * Requires C++20, though that could be changed with a little SFINAE trickery. | |
| * | |
| * Example code uses GPIO peripherals on an AM3358. | |
| * |
| // in action: https://godbolt.org/z/8z8r37rGP | |
| #include <algorithm> | |
| #include <array> | |
| #include <iostream> | |
| #include <tuple> | |
| #include <utility> | |
| class L { | |
| public: |
| #ifndef THROW_ERRNO_H | |
| #define THROW_ERRNO_H | |
| #include <cerrno> | |
| #include <string> | |
| #include <system_error> | |
| [[noreturn]] | |
| inline void throw_errno() { | |
| throw std::system_error(errno, std::system_category()); |
| #include <stdbool.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #define STX 0x02 | |
| #define ETX 0x03 | |
| int main(int argc, char** argv) { | |
| FILE* src = NULL; |
| #!/bin/sh | |
| set -e | |
| # For each tag in the repository (sorted in reverse chronological order), print | |
| # something like the following: | |
| # | |
| # ## Version <TAG> | |
| # <Tag body, if it has one, but not the body of the pointed-to commit> | |
| # |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| char arr[65536] = {0}; | |
| char* ptr = arr; | |
| int main(int argc, char** argv) { | |
| while (*ptr) { | |
| *ptr = getchar(); | |
| putchar(*ptr); |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdint.h> | |
| #include <errno.h> | |
| #include <ctype.h> | |
| #include <stdbool.h> | |
| #define SWAP(a,b) ((a)^=(b),(b)^=(a),(a)^=(b)) |