This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* MIT License | |
* | |
* Copyright (c) 2023 Dr. Thomas Lang | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 Dr. Thomas Lang | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software | |
# and associated documentation files (the “Software”), to deal in the Software without restriction, | |
# including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | |
# subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use PerlSpeak; | |
my @NAMES = ( | |
[qw(oh one two three four five six seven eight nine ann bet christ dot ernest frost)], | |
[qw(ten eleven twelve thirteen forteen fifteen sixteen seventeen eighteen nineteen annteen betteen christeen dotteen ernesteen frosteen)], | |
[qw(- - twenty thirty forty fifty sixty seventy eighty ninety annty betty christy dotty ernesty frosty)] | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
#include <bitset> | |
#include <limits> | |
#include <memory> | |
#include <type_traits> | |
#define GENERATE_PRINT_FUNCTION |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Singleton pattern as described by Andrei Alexandrescu in "Modern C++ Design" | |
#include <cassert> | |
#include <cstdlib> | |
#include <iostream> | |
//////////////////////////////////////////////////////////////////////////////// | |
namespace singleton { | |
/// Singleton implementation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playing around with meta-functions, placeholders and stuff. Thomas Lang, 2018. | |
#include <iostream> | |
#include <typeinfo> | |
namespace placeholder_helper { | |
// Helper utility for finding the N'th argument in a template parameter pack. | |
template<int Current, int N, typename FirstArg, typename... Args> | |
struct find_arg { | |
static_assert(Current < N, "Invalid argument position!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple mixins in C++. Thomas Lang, 2018. | |
#include <iostream> | |
#include <list> | |
namespace { | |
// add const reference to type. | |
template<typename T> | |
struct add_cref : std::add_lvalue_reference<std::add_const<T> > {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -Wall -std=c++11 -o crtp CuriouslyRecurringTemplatePattern.cc | |
// Curiously Recurring Template Pattern (CRTP) | |
// | |
// When this is used, a child class inherits from a base class templated with the own class. | |
#include <iostream> | |
// Example 1: A Counter for a class instances. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Short snippet for a custom iterator, taken from cppreference. | |
// Minimally adapted, just for the sake of showing it. | |
// clang++ -Wall -std=c++1z -o rangetest -O3 Range.cc | |
#include <iostream> | |
#include <iterator> | |
namespace range { | |
// A simple range [From .. To] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SAT where | |
-- simple file for generating an SLD tree (TESTED ON ONE FORMULA ONLY!) | |
-- (c) Thomas Lang, 2017 | |
import Data.List | |
-- A literal, can be either positive or negative | |
data Literal = L String | |
| NEG String |
NewerOlder