{"_id":"variant-hpp","_rev":"68-a8d6d24d29b28bf0b42dc8ec75c0c503","name":"variant-hpp","time":{"modified":"2022-06-28T09:07:28.343Z","created":"2016-06-29T17:36:50.203Z","1.1.0":"2016-06-29T17:36:50.203Z","1.1.0-alpha":"2016-06-29T17:41:51.322Z"},"maintainers":[{"name":"springmeyer","email":"dane@mapbox.com"}],"dist-tags":{"latest":"1.1.0-alpha"},"description":"C++11/C++14 variant","readme":"# Mapbox Variant\n\nAn alternative to `boost::variant` for C++11 and C++14\n\n[![Build Status](https://secure.travis-ci.org/mapbox/variant.svg)](https://travis-ci.org/mapbox/variant)\n[![Build status](https://ci.appveyor.com/api/projects/status/v9tatx21j1k0fcgy)](https://ci.appveyor.com/project/Mapbox/variant)\n[![Coverage Status](https://coveralls.io/repos/mapbox/variant/badge.svg?branch=master&service=github)](https://coveralls.io/r/mapbox/variant?branch=master)\n\n\n## Why use Mapbox Variant?\n\nMapbox variant has the same speedy performance of `boost::variant` but is\nfaster to compile, results in smaller binaries, and has no dependencies.\n\nFor example on OS X 10.9 with clang++ and libc++:\n\nTest | Mapbox Variant | Boost Variant\n---- | -------------- | -------------\nSize of pre-compiled header (release / debug) | 2.8/2.8 MB         | 12/15 MB\nSize of simple program linking variant (release / debug)     | 8/24 K             | 12/40 K\nTime to compile header     | 185 ms             |  675 ms\n\n(Numbers from an older version of Mapbox variant.)\n\n\n## Goals\n\nMapbox `variant` has been a very valuable, lightweight alternative for apps\nthat can use c++11 or c++14 but that do not want a boost dependency.\nMapbox `variant` has also been useful in apps that do depend on boost, like\nmapnik, to help (slightly) with compile times and to majorly lessen dependence\non boost in core headers. The original goal and near term goal is to maintain\nexternal API compatibility with `boost::variant` such that Mapbox `variant`\ncan be a \"drop in\". At the same time the goal is to stay minimal: Only\nimplement the features that are actually needed in existing software. So being\nan \"incomplete\" implementation is just fine.\n\nCurrently Mapbox variant doesn't try to be API compatible with the upcoming\nvariant standard, because the standard is not finished and it would be too much\nwork. But we'll revisit this decision in the future if needed.\n\nIf Mapbox variant is not for you, have a look at [these other\nimplementations](doc/other_implementations.md).\n\nWant to know more about the upcoming standard? Have a look at our\n[overview](doc/standards_effort.md).\n\n\n## Depends\n\n - Compiler supporting `-std=c++11` or `-std=c++14`\n\nTested with:\n\n - g++-4.7\n - g++-4.8\n - g++-4.9\n - g++-5.2\n - clang++-3.5\n - clang++-3.6\n - clang++-3.7\n - clang++-3.8\n - clang++-3.9\n - Visual Studio 2015\n\n## Usage\n\nThere is nothing to build, just include `variant.hpp` and\n`recursive_wrapper.hpp` in your project. Include `variant_io.hpp` if you need\nthe `operator<<` overload for variant.\n\n\n## Unit Tests\n\nOn Unix systems compile and run the unit tests with `make test`.\n\nOn Windows run `scripts/build-local.bat`.\n\n\n## Limitations\n\n* The `variant` can not hold references (something like `variant<int&>` is\n  not possible). You might want to try `std::reference_wrapper` instead.\n\n\n## Deprecations\n\n* The included implementation of `optional` is deprecated and will be removed\n  in a future version. See https://github.com/mapbox/variant/issues/64.\n* Old versions of the code needed visitors to derive from `static_visitor`.\n  This is not needed any more and marked as deprecated. The `static_visitor`\n  class will be removed in future versions.\n\n\n## Benchmarks\n\n    make bench\n\n\n## Check object sizes\n\n    make sizes /path/to/boost/variant.hpp\n\n","versions":{"1.1.0-alpha":{"name":"variant-hpp","version":"1.1.0-alpha","description":"C++11/C++14 variant","main":"./package.json","repository":{"type":"git","url":"git://github.com/mapbox/variant.git"},"scripts":{"install":"node-gyp rebuild"},"gypfile":true,"gitHead":"0cc293e8612edcab7016592314fc076726d6a240","bugs":{"url":"https://github.com/mapbox/variant/issues"},"homepage":"https://github.com/mapbox/variant#readme","_id":"variant-hpp@1.1.0-alpha","_shasum":"0da8f5a613281ac24d03252a683a8996035c02f2","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"springmeyer","email":"dane@mapbox.com"},"dist":{"shasum":"0da8f5a613281ac24d03252a683a8996035c02f2","tarball":"https://registry.npmjs.org/variant-hpp/-/variant-hpp-1.1.0-alpha.tgz","integrity":"sha512-XZWGkH/fryDljARUdaS1mlGpPeFpUFmyHuggP0EtggClndOPWAzs7wmv/8qLD3y6U6In5TlOy83F8qIjJB1bew==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCp6S2acspB00whntHCD4UrQnERF4NMxBQLmWT6yivhbgIgWx//NZnaYqRfldxx/atN4pnqQbIurxcuxugnzaWfB9A="}]},"maintainers":[{"name":"springmeyer","email":"dane@mapbox.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/variant-hpp-1.1.0-alpha.tgz_1467222108588_0.44659890164621174"}}},"homepage":"https://github.com/mapbox/variant#readme","repository":{"type":"git","url":"git://github.com/mapbox/variant.git"},"bugs":{"url":"https://github.com/mapbox/variant/issues"},"readmeFilename":"README.md"}