Giter VIP home page Giter VIP logo

from-scratch's Introduction

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}));
}

from-scratch's People

Contributors

quuxplusone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.