Coder Social home page Coder Social logo

brisk's Introduction

brisk

Compiles on Linux & Mac (using Make) and Windows (using MinGW-make or the toolchain of your choice)

Background

brisk is a header-only library that I've written myself for myself. This is not full featured and is just a pet project but it could be a valuable learning tool for those who need illustration on how the STL actually works under the hood without the mangled symbols, crazy template parameters.

The goal is to rewrite the STL using the latest standard in readable code.

Usage

First, refer to the Build section for your platform. So, now, you officially have set it up I'll assume.

All the libraries are split up into their respective headers. The libraries in brisk are:

  • algorithm, a WIP library including copy functions for array and vector
  • array, a replacement for std::array
  • functional, a replacement for the functional header
  • logger, a pretty good wrapper around std::cin and std::cout that will dump everything output to the console to a log file automagically for you
  • math, containers for geometric shapes
  • memory, smart pointer stuff
  • string, a replacement for std::string
  • utility, a replacement for the utility header
  • vector, a replacement for std::vector

Including brisk.h will, for namesakes, include all of these. However, just append .hpp to the library name to just get the library you want.

Requirements

Linux

  • Compiler (with C++20 support)
  • git
  • make (only if compiling test program)

Windows

  • Cygwin or MinGW (in PATH)
  • Git
  • Compiler (with C++20 support)

Build (Linux)

  1. Install the git package.
  2. Clone repository using git clone https://github.com/akachronix/brisk.git
  3. Run makefile to build examples or use headers in your own project.

Build (Windows)

  1. Install Git for Windows.
  2. Clone repository using git clone https://github.com/akachronix/brisk.git
  3. Open MinGW environment to repository directory.
  4. Run makefile to build examples or use headers in your own project.

Help

If you think you've found a bug, leave an issue. If you have some changes to suggest, make a pull request or put [REQUEST] before an issue.

brisk's People

Contributors

akachronix avatar

Watchers

 avatar  avatar

brisk's Issues

brisk::string::insert() memory juggling

code for recreating the string is buggy and somewhere it copies from freed memory, likely a problem with the memcpy calls

string& insert(size_t index, const string& s)
{
    char* old_str = new char[m_size + 1];
    memcpy(old_str, m_string, m_size + 1);

    if (m_string != nullptr)
        delete[] m_string;
    
    m_string = new char[m_size + s.size() + 1];
    memcpy(m_string, s.data(), index + 1);
    memcpy(m_string + index, s.data(), s.size());
    memcpy(m_string + index + s.size(), old_str + index, m_size - index);

    m_size += s.size();
    m_string[m_size + 1] = '\0';

    delete[] old_str;
    return *this;
}

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.