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
template<typename T, size_t N> | |
T* end_of(T (&arr)[N]) | |
{ | |
return &arr[0]+N; | |
} | |
// ... | |
int arr[42]; | |
std::fill(arr, end_of(arr), 25); |
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
# polymorphism in bash ? | |
prepare_c() { | |
cp ~/c_skeleton $1 | |
cp ~/c_makefile_skeleton $1 | |
} | |
prepare_bash() { | |
cp ~/bash_skeleton $1 | |
} |
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
/////////////////////////////////////////////////////////////////////////////// | |
// dyn.cc - compiled and linked as a dynamic library | |
/////////////////////////////////////////////////////////////////////////////// | |
#include <iostream> | |
extern "C" void fun() | |
{ | |
std::cout << "BOOYA!!1! fun() invoked!\n"; | |
} |
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<stdlib.h> | |
#include<stdio.h> | |
typedef struct state_t { | |
int current_line; | |
int heading_level; | |
token* previous_token; | |
} state; | |
state* state_with(state* s) /* just for readability when invoking */ |
NewerOlder