Giter Club home page Giter Club logo

switchable_wrapper's Introduction

Switchable Wrapper

Switchable Wrapper is a simple, easy-to-use container wrapper providing switchable bounding check.

Getting Started

Prerequisites

Installing

This is a header-only library so that simply include wrapper.hpp could work.

Running the tests

Get in the root of this project and make test.

make test
./test

Usage

Check test's code in unit_test/ for detail.

sw::wrapper<vector<T>> vec;  // normal vector
sw::wrapper<vector<T>, false> vec;  // same as above

sw::wrapper<vector<T>, true> vec_on(5, 0);  
// vector with auto-check each operator[] range.
// if illegal, throw std::out_of_range.

vec_on.set_upper(3);    // user-define upper bound
vec_on.set_lower(2);    // user-define lower bound

vec_on[3] = 1;          
// this will throw exception due to index(3) >= upper
// index need to be >= lower and < upper and < size()

sw::wrapper_s<vector<T>, false> vec_s_on(5, 0);
vec_s_on.set_special(0, 1, 3, 4);
// if index hit these special value, throw exception

Contributing

Please read CONTRIBUTING.md for details on this code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

switchable_wrapper's People

Stargazers

Chi-Lin, Hsieh avatar Chun-Hung Tseng avatar Gino Lu avatar Wei-Chieh Chen avatar

Watchers

James Cloos avatar Gino Lu 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.