OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine/overloaded.cpp

Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

#include <iostream>
auto main() -> int {
using namespace eagine;
using std::cout;
using std::endl;
using v = string_view;
auto func = overloaded(
[](int x) { cout << "int: " << x << endl; },
[](float x) { cout << "float: " << x << endl; },
[](double x) { cout << "double: " << x << endl; },
[](string_view x) { cout << "string: " << x << endl; },
[](auto x) { cout << "other: " << x << endl; });
func(v("zero"));
func(123);
func(45.F);
func(67.8);
func('9');
return 0;
}
basic_string_span< const char > string_view
Alias for const string views.
Definition: string_span.hpp:116
Common code is placed in this namespace.
Definition: eagine.hpp:21

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).