This file contains 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
def makeFun(name, *args): | |
exec("""def {}({}): raise NotImplementedError("'{}' is not implemented!")""".format(name, ', '.join(args), name)) | |
return locals()[name] | |
class ABC(type): | |
def __init__(cls, name, bases, dct): | |
for k, v in cls.__dict__.items(): | |
if not k.startswith("__") and callable(v): | |
setattr(cls, k, makeFun(k, *v.__code__.co_varnames)) | |
This file contains 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 <stddef.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "stack.h" | |
typedef struct stack(int) IntStack; | |
int main(int argc, char *argv[]) { | |
createStack(IntStack, stack, int, 5); |
This file contains 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
#pragma once | |
#include <iostream> | |
// T1 should be a stateless class that has only one member function | |
// T2 can be any noexcept constructible class | |
template <class T1, class T2> | |
// We inherit from T1 to provide the functionality of T1 without | |
// incurring any additional memory | |
class SimpleCompressedPair : T1 |