Giter Club home page Giter Club logo

variant's Introduction

Mapbox Variant

An alternative to boost::variant for C++11.

Build Status Build status

Why use Mapbox Variant?

Mapbox variant has the same speedy performance of boost::variant but is faster to compile, results in smaller binaries, and has no dependencies.

For example on OS X 10.9 with clang++ and libc++:

Test Mapbox Variant Boost Variant
Size of pre-compiled header (release / debug) 2.8/2.8 MB 12/15 MB
Size of simple program linking variant (release / debug) 8/24 K 12/40 K
Time to compile header 185 ms 675 ms

Depends

  • Compiler supporting -std=c++11

Tested with

  • g++-4.7
  • g++-4.8
  • clang++-3.4
  • clang++-3.5
  • Visual C++ Compiler November 2013 CTP
  • Visual C++ Compiler 2014 CTP 4

Note: get the "2013 Nov CTP" release at http://www.microsoft.com/en-us/download/details.aspx?id=41151 and the 2014 CTP at http://www.visualstudio.com/en-us/downloads/visual-studio-14-ctp-vs.aspx

Usage

There is nothing to build, just include variant.hpp and recursive_wrapper.hpp in your project.

Tests

The tests depend on:

  • Boost headers (for benchmarking against boost::variant)
  • Boost built with --with-timer (used for benchmark timing)

On Unix systems set your boost includes and libs locations and run make test:

export LDFLAGS='-L/opt/boost/lib'
export CXXFLAGS='-I/opt/boost/include'
make test

On windows do:

vcbuild

Benchmark

On Unix systems run the benchmark like:

make bench

Check object sizes

make sizes /path/to/boost/variant.hpp

variant's People

Contributors

artemp avatar dennisosrm avatar joto avatar kkaefer avatar

Watchers

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