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 <new> | |
#include <iostream> | |
#include <iomanip> | |
#include <exception> | |
#include <cstdlib> | |
// global overrides of new and delete | |
void* _new(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 <iostream> | |
class C | |
{ | |
public: | |
C(const int i) : | |
_i(i) | |
{ | |
} |
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 "sample-expl-templ.hpp" | |
#include <iostream> | |
typedef uint16_t WORD; | |
int main() | |
{ |
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
import java.util.function.Consumer; | |
public class SampleLambda { | |
// takes a function object that, in turn, takes a String argument and returns Void; | |
// this function object is a Consumer because it inherently returns nothing; | |
// the alternative--Function<T,R>--must have a return type | |
public static void foo(Consumer<String> func) { | |
func.accept("foo"); |
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 <functional> | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
// define a templated function to be able to take any "callable" as argument | |
template<typename Func> | |
void foo(Func func) |
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 <functional> | |
using namespace std; | |
class ScopedAction | |
{ | |
public: |
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
import unittest | |
# a generic function decorator to memoize call results | |
class Memoize(object): | |
def __init__(self, func): | |
self.func = func | |
self._cache = {} | |
self._count = 0 |
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
CC = gcc | |
CFLAGS = -Wall -g -x c++ | |
LFLAGS = -lstdc++ -lboost_unit_test_framework | |
DEFINES = -DUSE_BOOST_UT | |
OBJDIR = obj | |
BINDIR = bin | |
TARGET = bytes2hex |
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
CC = gcc | |
CFLAGS = -Wall -g -x c++ | |
LFLAGS = -lstdc++ -lm -lboost_unit_test_framework | |
DEFINES = -D TOPDOWN -D USE_BOOST_UT | |
OBJDIR = obj | |
BINDIR = bin | |
TARGET = main |
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
import unittest | |
class BST(object): | |
def __init__(self, key): | |
self.key = key | |
self.left = None | |
self.right = None | |