From 25ec03f84b4e0db2f4a10c6768891ce68c0c466c Mon Sep 17 00:00:00 2001 From: sha512sum Date: Mon, 15 Jul 2024 17:47:19 +0000 Subject: [PATCH] Add example for switch default call with void --- examples/src/switch.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/examples/src/switch.cpp b/examples/src/switch.cpp index 20aecee..161c061 100644 --- a/examples/src/switch.cpp +++ b/examples/src/switch.cpp @@ -27,4 +27,18 @@ auto main() -> int { }); return response; }() == 3); + static_assert([] { + int response{}; + utempl::Switch( + utempl::Tuple{2, 1, 0}, + utempl::Tuple{0, 1, 2}, + 3, + [&](int value) { + response = value + 1; + }, + [&] { + response = 3; + }); + return response; + }() == 3); };