• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    C++
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

C++ standard library features, "from scratch"

This repository contains "from scratch" implementations of many C++17 standard library features. It's intended for use with my upcoming workshop on "The Standard Library From Scratch".

This code is not intended for use in production!

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.

(That is, I won't stop you from using it, but it's liable to be inefficient, incomplete, incorrect, non-portable, and so on. Use the actual standard library instead; it's what it's there for.)

The good stuff

If you're looking for the code snippets, you should skip straight to the bits/ subdirectory.

git log is your friend

The git history of this repo is just as much a part of the "product" as the code at the current top-of-tree. I'll try to keep the commits topical, and if I find out that something in the history is wrong, I'll go fix it. This means that this repo will be force-pushed a lot.

If you're browsing the code, all you need to know is that git log and git blame will be very useful to you.

Writing test cases

In general, you should be able to compile a test program with

g++ -std=c++14 -I ${THIS_REPO}/include/ test.cc

The "from scratch" library should behave pretty much the same as the standard library; just do a global search-and-replace on your #includes and your stds.

#include <scratch/algorithm>

int main() {
    scratch::vector<int> v{3, 1, 4, 1, 5, 9};
    scratch::sort(v.begin(), v.end());
    assert((v == scratch::vector<int>{1, 1, 3, 4, 5, 9}));
}

More Repositories

1

Castlequest

Fortran
104
star
2

coro

Single-header library facilities for C++2a Coroutines
C++
79
star
3

Advent

A modern ANSI C port of Crowther & Woods' "Adventure".
C
77
star
4

ring_view

std::ring_span (SG14, P0059R1)
C++
45
star
5

Hanabi

Framework for writing bots that play Hanabi.
C++
36
star
6

Xoshiro256ss

A minimal xoshiro256** generator with the C++ <random> interface
C
32
star
7

WideIntProofOfConcept

Trying to get perfect codegen for big-integer math.
C++
30
star
8

Homeworlds

A C++ framework for working with the game of Binary Homeworlds, including a text interface to a simple AI.
C++
20
star
9

TNT

Douglas Hofstadter's "Typographical Number Theory"
Python
16
star
10

analog-literals

C++
15
star
11

difdef

Utility to do an N-way diff and N-way merge, for N>2. Uses the patience diff algorithm.
C++
12
star
12

futures-from-scratch

C++
9
star
13

JugglersDrift

Software for displaying multi-juggler runarounds. On an Ubuntu 11.10 system, run "sudo apt-get libpng12-dev", then read the README.
C++
9
star
14

libexplain

Unmaintained snapshot of https://sourceforge.net/projects/libexplain/
C
7
star
15

tbb

Intel's Threading Building Blocks (GPLv2)
C++
5
star
16

CppConTimer

Full-screen countdown timer for conference presenters
HTML
5
star
17

Mwc256XXA64

A minimal "MWC-X-A-256/64" generator with the C++ <random> interface
C++
4
star
18

Fishspear

C++14 implementation of the Fishspear priority-queue data structure
C++
4
star
19

hello-extension

The simplest possible C++ extension for Python3. No Boost.
C++
3
star
20

MetaSudoku

Meta-sudoku solver: https://quuxplusone.github.io/blog/2018/10/26/sudoku-stories/
C++
2
star
21

KnuthElevator

Elevator simulator from Knuth's TAOCP volume 1, section 2.2.5.
C++
2
star
22

Buddhabrot

C++14 Buddhabrot renderer, based on Alex Boswell's code
C++
2
star
23

Chimaera

Chris Newall's "Chimaera" adventure game. http://www.mipmip.org/chimaera/
C
2
star
24

cwg-issue-browser

How I wish wg21.link/cwg1234 worked
Python
1
star
25

church-numerals

Church numerals in C++14, C++11, and C++03.
C++
1
star
26

PeacefulEncampments

JavaScript visualizer for the "Peaceful Encampments" problem
HTML
1
star
27

Fungus

The Fungus virtual machine
C
1
star
28

canonical-cxx

Annotated, cut-and-pasteable skeletons for various kinds of C++ class types.
C++
1
star
29

Lielow

https://quuxplusone.github.io/Lielow
CSS
1
star
30

AdventOfCode

Google Advent of Code solutions, https://adventofcode.com
C++
1
star
31

objectivecpp-for-komodoedit

KomodoEdit extension for syntax-highlighting Objective-C++ files
Python
1
star
32

RecreationalMath

Various small programs related to recreational math/CS problems
Python
1
star
33

wolves-and-sheep

https://puzzling.stackexchange.com/questions/81737/wolves-and-sheep/
C++
1
star