I hereby claim:
- I am xealits on github.
- I am alex_toldaiev (https://keybase.io/alex_toldaiev) on keybase.
- I have a public key ASCzSvsKrscH62AXDRlMSAWr_qCTE-c4i6EUDECNisX1pgo
To claim this, I am signing this object:
#define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL | |
#include "doctest.h" | |
//int factorial(int number) { return number <= 1 ? number : factorial(number - 1) * number; } | |
int factorial(int number) { return number <= 1 ? 1 : factorial(number - 1) * number; } | |
TEST_CASE("testing the factorial function") { | |
CHECK(factorial(0) == 1); | |
CHECK(factorial(1) == 1); | |
CHECK(factorial(2) == 2); |
I hereby claim:
To claim this, I am signing this object:
#[ | |
# the example is from https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html | |
# plus I used `quote` instead of direct tree nodes | |
# it almost works the same way | |
# except, it seems you cannot declare an empty `enum` under `quote` | |
]# | |
import math, strutils | |
import macros |
/* | |
* Just some notes while reading Game Programming Patterns by Robert Nystrom | |
* https://gameprogrammingpatterns.com | |
* | |
* A command or event made with C++ std::variant. | |
* The idea is to pack some similar-size but different types into the command. | |
* How to subscribe components to events from each other | |
* and construct it declaratively, at compile time? | |
* The components send events or commands (command pattern). | |
* You want to verify the interfaces, preferably statically, i.e. at link time. |
Find references to non-const pointees:
clang-query -c "set output dump" -c "m varDecl(hasType(referenceType(pointee(unless(isConstQualified())))))" source.cpp
#include <iostream> | |
#include <source_location> | |
#include <string> | |
struct Quack; | |
template <typename T> | |
concept Duck = requires(T t) { | |
{ t.quack() } -> std::convertible_to<Quack>; | |
// could be -> std::same_as<Quack>; | |
}; |