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 <ostream> | |
#define DEFINE_NAMED_ARG(type, arg_name, arg_type) \ | |
struct type \ | |
{ \ | |
type(arg_type val = arg_type()) \ | |
: val_(val) \ | |
{} \ | |
\ |
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 <time.h> | |
#include <sys/time.h> | |
#include <iostream> | |
#include <ostream> | |
// POSIX Mach | |
// clock_gettime clock_get_time | |
// CLOCK_REALTIME CALENDAR_CLOCK | |
// CLOCK_MONOTONIC REALTIME_CLOCK |
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
// This is a simple example of an algorithm that does a binary search in | |
// a [m, n] matrix containing integer numbers, ordered such that for each | |
// i, j and k, l that i<=k and j<=l, m[i][j] <= m[k][l]. | |
// The matrix is pregenerated and the dimensions are fixed for simplicity. | |
// However the algorithm itself is generic enough to handle any ordered matrix. | |
#include <iostream> | |
#include <ostream> | |
#include <iomanip> | |
#include <vector> |
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
// C++11 has thread-safe function local statics, but this code is just | |
// to illustrate how one would do a thread-safe one-time initialization | |
// using atomic variables. | |
#include <atomic> | |
#include <thread> | |
#include <cassert> | |
#include <vector> | |
using namespace std; |
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
testing: by value | |
* lvalue | |
lvalue: cctor | |
lvalue: mctor | |
* xvalue | |
xvalue: mctor | |
xvalue: mctor | |
* rvalue | |
rvalue: mctor | |
* done |
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> | |
template <typename ...Funcs> | |
struct overload_set; | |
template <typename Head, typename ...Tail> | |
struct overload_set<Head, Tail...> : Head, overload_set<Tail...> | |
{ | |
overload_set(Head head, Tail... tail) | |
: Head{head} |
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> | |
template<typename F, typename ...Ts> | |
class is_callable | |
{ | |
template<typename G, typename ...Us> | |
static | |
decltype( | |
typename std::add_pointer<decltype(std::declval<G>()(std::declval<Us>()...))>::type{}, | |
std::true_type{}) |
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
diff -u -r a/CRT.c b/CRT.c | |
--- a/CRT.c 2012-10-19 14:59:28.000000000 -0400 | |
+++ b/CRT.c 2013-01-28 12:08:36.812929000 -0500 | |
@@ -562,7 +562,7 @@ | |
CRT_colors[LED_COLOR] = ColorPair(Green,Black); | |
CRT_colors[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black); | |
CRT_colors[PROCESS] = A_NORMAL; | |
- CRT_colors[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Black); | |
+ CRT_colors[PROCESS_SHADOW] = A_BOLD | ColorPair(Green,Black); | |
CRT_colors[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black); |
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
<html> | |
<head> | |
<title>CoffeeScript charts</title> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
google.load("visualization", "1", {packages:["corechart"]}); | |
google.load("visualization", "1", {packages:["table"]}); | |
</script> |
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 <boost/iostreams/stream_buffer.hpp> | |
#include <boost/iostreams/device/null.hpp> | |
#include <iostream> | |
namespace io = boost::iostreams; | |
int main() | |
{ | |
io::stream_buffer<io::null_sink> null_buf{io::null_sink()}; | |
std::cout.rdbuf(&null_buf); |
OlderNewer