Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1287

Answer by HolyBlackCat for expand parameter pack with boolean operation

$
0
0

Fold expressions must be enclosed in (...): return ((ts == value) || ... || (false));.

Also you can drop || false, it's implicit for || folds.

Also I would like to get rid of specifying the type if possible (e.g. the <int>)

You can do this by replacing <typename T, T ...ts> with e.g. <auto ...ts, typename T>.

But if I was you, I'd pass all alternatives as function parameters (to allow them to be changed at runtime).


Viewing all articles
Browse latest Browse all 1287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>