Code exammple:
#include <string>
std::string __attribute__((warning("getString not inlined/removed"))) getString() {
return "Foo";
}| #include <tuple> | |
| // Macro to declare elements of an `enum class` | |
| #define DEFINE_ENUM_TYPE(type, id) type = id, | |
| // Declare currencies | |
| #define CURRENCIES(code) \ | |
| code(USD, 0) \ | |
| code(EUR, 1) |
| #include <algorithm> | |
| #include <optional> | |
| #include <type_traits> | |
| #include <unordered_map> | |
| #include <vector> | |
| #include <cstdio> | |
| // http://tristanbrindle.com/posts/a-quicker-study-on-tokenising/ | |
| template <typename Iterator, typename Lambda> |
| #include <array> | |
| #include <iostream> | |
| #include <iomanip> | |
| namespace { | |
| template <typename T, std::size_t N> | |
| auto print_array(std::array<T, N> a) { | |
| std::cout << "array: |"; | |
| for (auto const& e : a) { | |
| std::cout << std::setw(2) << e << "|"; |
| // http://jakascorner.com/blog/2016/05/omp-monte-carlo-pi.html | |
| #include <iostream> | |
| #include <chrono> | |
| #include <random> | |
| #include <vector> | |
| #include <string> | |
| #include <iomanip> | |
| #include <limits> | |
| #include <chrono> |
| /* | |
| * Character | Meaning | |
| * c | Matches any literal character c | |
| * . | Matches any single character | |
| * ^ | Matches the beginning of the input string | |
| * $ | Matches the end of the input string | |
| * * | Matches zero or more occurrences of the previous character | |
| */ | |
| #include <cstdio> |
| // http://ldionne.com/hana-cppnow-2015/ | |
| // http://boostorg.github.io/hana/ | |
| // note: re-read the CppCon pres on fusion for parsing | |
| // somehow hold the tag and value type in the field's type? | |
| template <int Tag, typename T> | |
| struct Field { T value; } | |
| template <int Tag, typename T> | |
| constexpr auto get_tag(field<Tag, T>&&) { return Tag; } |
| style: | |
| @for src in $(SOURCES) ; do \ | |
| echo "Formatting $$src..." ; \ | |
| clang-format -i "$(SRC_DIR)/$$src" ; \ | |
| clang-tidy -checks='-*,readability-identifier-naming' \ | |
| -config="{CheckOptions: [ \ | |
| { key: readability-identifier-naming.NamespaceCase, value: lower_case },\ | |
| { key: readability-identifier-naming.ClassCase, value: CamelCase },\ | |
| { key: readability-identifier-naming.StructCase, value: CamelCase },\ | |
| { key: readability-identifier-naming.FunctionCase, value: camelBack },\ |