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
// https://isocpp.org/blog/2014/12/myths-1 | |
// | |
// Bjarne Stroustrup. | |
// | |
// 2. Myth 1: “To understand C++, you must first learn C” | |
// | |
// No. Learning basic programming using C++ is far easier than with C. | |
// | |
// C is almost a subset of C++, but it is not the best subset to learn first | |
// because C lacks the notational support, the type safety, and the easier-to-use |
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
// C++11 - use multiple source files. | |
#include "lest.hpp" | |
lest::tests & specifications() | |
{ | |
static lest::tests tests; | |
return tests; | |
} |
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
// replacing a loop (compute_loop()) with an std::algorithm. | |
#include <algorithm> | |
#include <functional> | |
#include <vector> | |
using Coll = std::vector<int>; | |
int compute_loop( Coll a, Coll b ) | |
{ |
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 <iostream> | |
#include <string> | |
#define sometimes if | |
bool is( std::string text ) | |
{ | |
return ! text.empty(); | |
} | |
std::string number( int x ) |
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
// This tells Catch to provide a main() - only do this in one cpp file: | |
#define CATCH_CONFIG_MAIN | |
#include "catch.hpp" |
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
// Sean Parent. Inheritance Is The Base Class of Evil. Going Native 2013 | |
// Video: https://www.youtube.com/watch?v=bIhUE5uUFOA | |
// Code : https://github.com/sean-parent/sean-parent.github.io/wiki/Papers-and-Presentations | |
/* | |
Copyright 2013 Adobe Systems Incorporated | |
Distributed under the MIT License (see license at | |
http://stlab.adobe.com/licenses.html) | |
This file is intended as example code and is not production quality. |
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
// clamp-range-v3 | |
#include <iostream> | |
#include <clamp.hpp> | |
#include <range/v3/core.hpp> | |
#include <range/v3/view/iota.hpp> | |
#include <range/v3/view/remove_if.hpp> | |
#include <range/v3/view/transform.hpp> |
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
// | |
// simple running average (mean and median) of samples. | |
// | |
#include <algorithm> | |
#include <cassert> | |
#include <numeric> | |
#include <vector> | |
#ifndef RUNLENGTH |
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 <iostream> | |
#include "phys/units/io.hpp" | |
#include "phys/units/quantity.hpp" | |
using namespace phys::units; | |
using namespace phys::units::io; | |
auto apple( unit( "apple", extend() ) ); | |
auto box ( unit( "box" , extend() ) ); |
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
@echo off & setlocal | |
:: mk-epub title #issue date source | |
if [%4] == [] goto :Usage | |
set PANDOC=pandoc | |
set TO=epub | |
set TITLE=%~1 |