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 <array> | |
#include <type_traits> | |
#include <print> | |
/// Compiled on g++ with: -std=c++23 -Og | |
/// Util. types | |
enum class StepPolicy { | |
forth, |
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 <type_traits> | |
#include <iostream> | |
struct Foo {}; | |
template <typename... Args> | |
struct TypeList {}; | |
template <int N, typename Target> | |
constexpr int searchTypeImpl() { |
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 <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
typedef enum { | |
thing_flag, | |
thing_number, | |
thing_nil | |
} Thing; |
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 <utility> | |
#include <concepts> | |
#include <algorithm> | |
#include <array> | |
#include <string> | |
template <template <typename> typename Buffer, typename ItemT> | |
concept BufferKind = requires(Buffer<ItemT>&& arg, std::size_t count) { | |
{arg.getPtr()} -> std::same_as<ItemT*>; | |
{arg.getSize()} -> std::same_as<std::size_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
#include <algorithm> | |
#include <array> | |
#include <string_view> | |
#include <utility> | |
#include <print> | |
// This was compiled and ran on Compiler Explorer: | |
// Compiler flags: -std=c++26 -Og | |
// Note: The call operator for the evaluator did not get generated at all, and the expected result of 42 was embedded in a single MOV. |
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 <memory> | |
#include <iostream> | |
enum class MyStorageKind { | |
static_ptr, // pointer to non-member function | |
dud_ptr | |
}; | |
template <typename Result, typename... Args> | |
class MyFunc { |
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 <type_traits> | |
#include <utility> | |
#include <stdexcept> | |
#include <print> | |
template <std::size_t Index, typename T1, typename T2> | |
struct TpChooser {}; | |
template <typename T1, typename T2> | |
struct TpChooser<0, T1, T2> |
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 <stdexcept> | |
#include <type_traits> | |
#include <utility> | |
#include <iostream> | |
// Optional v2: semi-serious attempt using cppref as a reference. | |
// NOTE: There are some caveats e.g not handling pointer types, etc. | |
namespace toy { |
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
#ifndef MY_ANY_HPP | |
#define MY_ANY_HPP | |
#include <stdexcept> | |
#include <type_traits> | |
#include <utility> | |
#include <memory> | |
#include <typeinfo> | |
/* |
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> | |
/* | |
Attempt at CRTP visitor sample | |
DrkWithT | |
*/ | |
/// Forward decls. of visitable objects | |
class OneBox; | |
class TwoBox; |
NewerOlder