aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/project/main.cpp
blob: 1f59c1a0e06f5f6e4e9e6d3bdc730c8070176783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <mapbox/variant.hpp>
#include <stdexcept>
struct check
{
    template <typename T>
    void operator()(T const& val) const
    {
        if (val != 0) throw std::runtime_error("invalid");
    }
};
int main()
{
    typedef mapbox::util::variant<bool, int, double> variant_type;
    variant_type v(0);
    mapbox::util::apply_visitor(check(), v);
    return 0;
}